backend = new Backend\Database($user); $this->abinfo = array('displayname' => uniqid('display_')); $this->ab = new AddressBook($this->backend, $this->abinfo); $this->provider = new AddressbookProvider($this->ab); $card = \Sabre\VObject\Component::create('VCARD'); $uid = substr(md5(rand().time()), 0, 10); $card->add('UID', $uid); $card->add('FN', 'Max Mustermann'); $id = $this->ab->addChild($card); Utils\Properties::updateIndex($id, $card); $this->contactIds[] = $id; // Add extra contact $card = \Sabre\VObject\Component::create('VCARD'); $uid = substr(md5(rand().time()), 0, 10); $card->add('UID', $uid); $card->add('FN', 'Jan Janssens'); $id = $this->ab->addChild($card); Utils\Properties::updateIndex($id, $card); $this->ab->deleteChild($id); } public function tearDown() { unset($this->backend); unset($this->ab); // var_dump($this->contactIds); // die(); Utils\Properties::purgeIndexes($this->contactIds); } public function testSearch() { $result = $this->provider->search('',array('FN'), array()); $this->assertTrue(is_array($result)); $this->assertEquals(1, count($result)); $this->assertEquals('Max Mustermann', $result[0]['FN']); } }