-
Notifications
You must be signed in to change notification settings - Fork 2
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
19 changed files
with
377 additions
and
30 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -321,6 +321,37 @@ public function testUpdateUserAdbContainer() | |
Addressbook_Controller_Contact::getInstance()->get($user->contact_id)->getIdFromProperty('container_id')); | ||
} | ||
|
||
public function testAddUserUpdateContact() | ||
{ | ||
$userToCreate = TestCase::getTestUser(); | ||
$pw = Tinebase_Record_Abstract::generateUID(12); | ||
|
||
$this->_usernamesToDelete[] = $userToCreate->accountLoginName; | ||
$user = Admin_Controller_User::getInstance()->create($userToCreate, $pw, $pw); | ||
|
||
$newContact = Addressbook_Controller_Contact::getInstance()->create(new Addressbook_Model_Contact([ | ||
'n_given' => 'foo', | ||
'n_family' => 'test', | ||
'email' => '[email protected]', | ||
'tel_cell_private' => '+49TELCELLPRIVATE', | ||
])); | ||
|
||
$oldContactId = $user->contact_id; | ||
$user->contact_id = $newContact->getId(); | ||
$user = Admin_Controller_User::getInstance()->update($user, $pw, $pw); | ||
static::assertEquals($newContact->getId(), $user->contact_id); | ||
|
||
$oldContact = Addressbook_Controller_Contact::getInstance()->get($oldContactId); | ||
static::assertEquals($oldContact->type, Addressbook_Model_Contact::CONTACTTYPE_CONTACT, 'old user contact should switch type to contact'); | ||
|
||
$newContact = Addressbook_Controller_Contact::getInstance()->get($user->contact_id); | ||
static::assertEquals($newContact->type, Addressbook_Model_Contact::CONTACTTYPE_USER, 'new user contact should switch type to user'); | ||
static::assertEquals($newContact->email, $user->accountEmailAddress, 'new contact email should be the same as user email'); | ||
static::assertEquals($newContact->n_fn, $user->accountFullName); | ||
static::assertEquals($newContact->n_fileas, $user->accountDisplayName); | ||
|
||
} | ||
|
||
public function testUpdateUserWithEmailButNoPassword() | ||
{ | ||
$this->_skipWithoutEmailSystemAccountConfig(); | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.