mirror of
https://github.com/owncloudarchive/contacts.git
synced 2024-12-01 13:24:10 +01:00
Contacts: 10 more assertions to AddressBook test.
This commit is contained in:
parent
55338242dd
commit
33f756845a
@ -90,9 +90,31 @@ class Test_Contacts_Backend_Datebase extends PHPUnit_Framework_TestCase {
|
||||
array(
|
||||
'displayname' => 'Contacts',
|
||||
'description' => 'My Contacts',
|
||||
'permissions' => OCP\PERMISSION_ALL,
|
||||
'owner' => self::$user,
|
||||
)
|
||||
);
|
||||
$this->assertEquals(0, count($addressBook));
|
||||
$id = $addressBook->addChild(
|
||||
array(
|
||||
'displayname' => 'John Q. Public'
|
||||
)
|
||||
);
|
||||
$this->assertNotEquals(false, $id);
|
||||
$this->assertEquals(1, count($addressBook));
|
||||
$contact = $addressBook->getChild($id);
|
||||
$this->assertEquals('John Q. Public', $contact->FN);
|
||||
$contact->FN = 'Max Mustermann';
|
||||
$contact->save();
|
||||
$contact = $addressBook[$id];
|
||||
$this->assertEquals('Max Mustermann', $contact->getMetaData()['displayname']);
|
||||
|
||||
// Array access
|
||||
$this->assertEquals($contact, $addressBook[$id]);
|
||||
$this->assertTrue(isset($addressBook[$id]));
|
||||
|
||||
// Magic accessors
|
||||
$this->assertEquals($contact, $addressBook->{$id});
|
||||
|
||||
$this->assertTrue($addressBook->deleteChild($id));
|
||||
$this->assertEquals(0, count($addressBook));
|
||||
}
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user