assertEquals(array(), self::$backend->getAddressBooksForUser()); $aid = self::$backend->createAddressBook( array( 'displayname' => 'Contacts', 'description' => 'My Contacts', ) ); // Test address books $this->assertEquals(1, count(self::$backend->getAddressBooksForUser())); $this->assertTrue(self::$backend->hasAddressBook($aid)); $addressBook = self::$backend->getAddressBook($aid); $this->assertEquals('Contacts', $addressBook['displayname']); $this->assertEquals('My Contacts', $addressBook['description']); self::$backend->updateAddressBook($aid, array('description' => 'All my contacts')); $addressBook = self::$backend->getAddressBook($aid); $this->assertEquals('All my contacts', $addressBook['description']); // Test contacts $this->assertEquals(array(), self::$backend->getContacts($aid)); $carddata = file_get_contents(__DIR__ . '/data/test.vcf'); $id = self::$backend->createContact($aid, $carddata); $this->assertNotEquals(false, $id); // Isn't there an assertNotFalse() ? $this->assertEquals(1, count(self::$backend->getContacts($aid))); $this->assertTrue(self::$backend->hasContact($aid, $id)); $contact = self::$backend->getContact($aid, $id); $this->assertEquals('Max Mustermann', $contact['displayname']); $carddata = file_get_contents(__DIR__ . '/data/test2.vcf'); $this->assertTrue(self::$backend->updateContact($aid, $id, $carddata)); $contact = self::$backend->getContact($aid, $id); $this->assertEquals('John Q. Public', $contact['displayname']); $this->assertTrue(self::$backend->deleteContact($aid, $id)); $this->assertTrue(self::$backend->deleteAddressBook($aid)); } public function testAddressBook() { $addressBook = new OCA\Contacts\AddressBook( self::$backend, array( 'displayname' => 'Contacts', 'description' => 'My Contacts', 'permissions' => OCP\PERMISSION_ALL, 'owner' => self::$user, ) ); } }