createAddressBook() public method

Creates a new address book
public createAddressBook ( string $principalUri, string $url, array $properties ) : void
$principalUri string
$url string Just the 'basename' of the url.
$properties array
return void
コード例 #1
0
 function testCreateAddressBookSuccess()
 {
     $this->backend->createAddressBook('principals/user1', 'book2', ['{DAV:}displayname' => 'book2', '{' . CardDAV\Plugin::NS_CARDDAV . '}addressbook-description' => 'addressbook 2']);
     $expected = [['id' => 1, 'uri' => 'book1', 'principaluri' => 'principals/user1', '{DAV:}displayname' => 'book1', '{' . CardDAV\Plugin::NS_CARDDAV . '}addressbook-description' => 'addressbook 1', '{http://calendarserver.org/ns/}getctag' => 1, '{http://sabredav.org/ns}sync-token' => 1], ['id' => 2, 'uri' => 'book2', 'principaluri' => 'principals/user1', '{DAV:}displayname' => 'book2', '{' . CardDAV\Plugin::NS_CARDDAV . '}addressbook-description' => 'addressbook 2', '{http://calendarserver.org/ns/}getctag' => 1, '{http://sabredav.org/ns}sync-token' => 1]];
     $result = $this->backend->getAddressBooksForUser('principals/user1');
     $this->assertEquals($expected, $result);
 }
コード例 #2
0
ファイル: AbstractPDOTest.php プロジェクト: samj1912/repo
 public function testCreateAddressBookSuccess()
 {
     $this->backend->createAddressBook('principals/user1', 'book2', array('{DAV:}displayname' => 'book2', '{' . CardDAV\Plugin::NS_CARDDAV . '}addressbook-description' => 'addressbook 2'));
     $expected = array(array('id' => 1, 'uri' => 'book1', 'principaluri' => 'principals/user1', '{DAV:}displayname' => 'book1', '{' . CardDAV\Plugin::NS_CARDDAV . '}addressbook-description' => 'addressbook 1', '{http://calendarserver.org/ns/}getctag' => 1, '{' . CardDAV\Plugin::NS_CARDDAV . '}supported-address-data' => new CardDAV\Property\SupportedAddressData()), array('id' => 2, 'uri' => 'book2', 'principaluri' => 'principals/user1', '{DAV:}displayname' => 'book2', '{' . CardDAV\Plugin::NS_CARDDAV . '}addressbook-description' => 'addressbook 2', '{http://calendarserver.org/ns/}getctag' => 1, '{' . CardDAV\Plugin::NS_CARDDAV . '}supported-address-data' => new CardDAV\Property\SupportedAddressData()));
     $result = $this->backend->getAddressBooksForUser('principals/user1');
     $this->assertEquals($expected, $result);
 }
コード例 #3
0
 static function getSQLiteDB()
 {
     $pdo = Backend\PDOSqliteTest::getSQLite();
     // Inserting events through a backend class.
     $backend = new Backend\PDO($pdo);
     $addressbookId = $backend->createAddressBook('principals/user1', 'UUID-123467', array('{DAV:}displayname' => 'user1 addressbook', '{urn:ietf:params:xml:ns:carddav}addressbook-description' => 'AddressBook description'));
     $backend->createAddressBook('principals/user1', 'UUID-123468', array('{DAV:}displayname' => 'user1 addressbook2', '{urn:ietf:params:xml:ns:carddav}addressbook-description' => 'AddressBook description'));
     $backend->createCard($addressbookId, 'UUID-2345', self::getTestCardData());
     return $pdo;
 }
コード例 #4
0
ファイル: TestUtil.php プロジェクト: samj1912/repo
 static function getSQLiteDB()
 {
     if (file_exists(SABRE_TEMPDIR . '/testdb.sqlite')) {
         unlink(SABRE_TEMPDIR . '/testdb.sqlite');
     }
     $pdo = new PDO('sqlite:' . SABRE_TEMPDIR . '/testdb.sqlite');
     $pdo->setAttribute(PDO::ATTR_ERRMODE, PDO::ERRMODE_EXCEPTION);
     // Yup this is definitely not 'fool proof', but good enough for now.
     $queries = explode(';', file_get_contents(__DIR__ . '/../../../examples/sql/sqlite.addressbooks.sql'));
     foreach ($queries as $query) {
         $pdo->exec($query);
     }
     // Inserting events through a backend class.
     $backend = new Backend\PDO($pdo);
     $addressbookId = $backend->createAddressBook('principals/user1', 'UUID-123467', array('{DAV:}displayname' => 'user1 addressbook', '{urn:ietf:params:xml:ns:carddav}addressbook-description' => 'AddressBook description'));
     $backend->createAddressBook('principals/user1', 'UUID-123468', array('{DAV:}displayname' => 'user1 addressbook2', '{urn:ietf:params:xml:ns:carddav}addressbook-description' => 'AddressBook description'));
     $backend->createCard($addressbookId, 'UUID-2345', self::getTestCardData());
     return $pdo;
 }