public function setUp() { parent::setUp(); $this->backend = new Backend\Mock('foobar'); $this->abinfo = $this->backend->getAddressBook('foo'); $this->ab = new AddressBook($this->backend, $this->abinfo); }
/** * @param AbstractBackend $backend The storage backend * @param array $addressBookInfo * @throws \Exception */ public function __construct(Backend\AbstractBackend $backend, array $addressBookInfo) { self::$l10n = \OCP\Util::getL10N('contacts'); $this->backend = $backend; $this->addressBookInfo = $addressBookInfo; if (is_null($this->getId())) { $id = $this->backend->createAddressBook($addressBookInfo); if ($id === false) { throw new \Exception('Error creating address book.', Http::STATUS_INTERNAL_SERVER_ERROR); } $this->addressBookInfo = $this->backend->getAddressBook($id); } //\OCP\Util::writeLog('contacts', __METHOD__.' backend: ' . print_r($this->backend, true), \OCP\Util::DEBUG); }
public function testGetAddressBookFail() { $this->assertNull($this->backend->getAddressBook('bar')); }