diff options
author | Andrew Manning <tamanning@zoho.com> | 2016-05-11 05:54:20 -0400 |
---|---|---|
committer | Andrew Manning <tamanning@zoho.com> | 2016-05-11 05:54:20 -0400 |
commit | d968fc51eab8b0fb259ecbeae517056b99554017 (patch) | |
tree | 10e551cff9fefbefbfd7e5031b57320116bb7fce /vendor/sabre/dav/tests/Sabre/CardDAV/PluginTest.php | |
parent | c7698e4dc388b7d9a9db368672cb057c1d4d3a01 (diff) | |
parent | 4dd3839c41e18d9724855e7955d8737b6f52dcd6 (diff) | |
download | volse-hubzilla-d968fc51eab8b0fb259ecbeae517056b99554017.tar.gz volse-hubzilla-d968fc51eab8b0fb259ecbeae517056b99554017.tar.bz2 volse-hubzilla-d968fc51eab8b0fb259ecbeae517056b99554017.zip |
Merge remote-tracking branch 'upstream/dev' into plugin-repo
Diffstat (limited to 'vendor/sabre/dav/tests/Sabre/CardDAV/PluginTest.php')
-rw-r--r-- | vendor/sabre/dav/tests/Sabre/CardDAV/PluginTest.php | 96 |
1 files changed, 25 insertions, 71 deletions
diff --git a/vendor/sabre/dav/tests/Sabre/CardDAV/PluginTest.php b/vendor/sabre/dav/tests/Sabre/CardDAV/PluginTest.php index 297ebf496..9c916350e 100644 --- a/vendor/sabre/dav/tests/Sabre/CardDAV/PluginTest.php +++ b/vendor/sabre/dav/tests/Sabre/CardDAV/PluginTest.php @@ -3,17 +3,16 @@ namespace Sabre\CardDAV; use Sabre\DAV; - -require_once 'Sabre/CardDAV/AbstractPluginTest.php'; +use Sabre\DAV\Xml\Property\Href; class PluginTest extends AbstractPluginTest { function testConstruct() { - $this->assertEquals('card', $this->server->xmlNamespaces[Plugin::NS_CARDDAV]); $this->assertEquals('{' . Plugin::NS_CARDDAV . '}addressbook', $this->server->resourceTypeMapping['Sabre\\CardDAV\\IAddressBook']); $this->assertTrue(in_array('addressbook', $this->plugin->getFeatures())); + $this->assertEquals('carddav', $this->plugin->getPluginInfo()['name']); } @@ -43,25 +42,6 @@ class PluginTest extends AbstractPluginTest { } - function testMeCardTest() { - - $result = $this->server->getProperties( - 'addressbooks/user1', - array( - '{http://calendarserver.org/ns/}me-card', - ) - ); - - $this->assertEquals( - array( - '{http://calendarserver.org/ns/}me-card' => - new DAV\Property\Href('addressbooks/user1/book1/vcard1.vcf') - ), - $result - ); - - } - function testDirectoryGateway() { $result = $this->server->getProperties('principals/user1', array('{' . Plugin::NS_CARDDAV . '}directory-gateway')); @@ -74,76 +54,50 @@ class PluginTest extends AbstractPluginTest { function testReportPassThrough() { - $this->assertNull($this->plugin->report('{DAV:}foo', new \DomDocument())); + $this->assertNull($this->plugin->report('{DAV:}foo', new \DomDocument(), '')); } function testHTMLActionsPanel() { $output = ''; - $r = $this->server->broadcastEvent('onHTMLActionsPanel', array($this->server->tree->getNodeForPath('addressbooks/user1'), &$output)); + $r = $this->server->emit('onHTMLActionsPanel', [$this->server->tree->getNodeForPath('addressbooks/user1'), &$output]); $this->assertFalse($r); $this->assertTrue(!!strpos($output,'Display name')); } - function testBrowserPostAction() { + function testAddressbookPluginProperties() { - $r = $this->server->broadcastEvent('onBrowserPostAction', array('addressbooks/user1', 'mkaddressbook', array( - 'name' => 'NEWADDRESSBOOK', - '{DAV:}displayname' => 'foo', - ))); - $this->assertFalse($r); + $ns = '{' . Plugin::NS_CARDDAV . '}'; + $propFind = new DAV\PropFind('addressbooks/user1/book1', [ + $ns . 'supported-address-data', + $ns . 'supported-collation-set', + ]); + $node = $this->server->tree->getNodeForPath('addressbooks/user1/book1'); + $this->plugin->propFindEarly($propFind, $node); - $addressbooks = $this->backend->getAddressBooksforUser('principals/user1'); - $this->assertEquals(2, count($addressbooks)); + $this->assertInstanceOf( + 'Sabre\\CardDAV\\Xml\\Property\\SupportedAddressData', + $propFind->get($ns . 'supported-address-data') + ); + $this->assertInstanceOf( + 'Sabre\\CardDAV\\Xml\\Property\\SupportedCollationSet', + $propFind->get($ns . 'supported-collation-set') + ); - $newAddressBook = null; - foreach($addressbooks as $addressbook) { - if ($addressbook['uri'] === 'NEWADDRESSBOOK') { - $newAddressBook = $addressbook; - break; - } - } - if (!$newAddressBook) - $this->fail('Could not find newly created addressbook'); } - function testUpdatePropertiesMeCard() { + function testGetTransform() { - $result = $this->server->updateProperties('addressbooks/user1', array( - '{http://calendarserver.org/ns/}me-card' => new DAV\Property\Href('/addressbooks/user1/book1/vcard2',true), - )); + $request = new \Sabre\HTTP\Request('GET', '/addressbooks/user1/book1/card1', ['Accept: application/vcard+json']); + $response = new \Sabre\HTTP\ResponseMock(); + $this->server->invokeMethod($request, $response); - $this->assertEquals( - array( - 'href' => 'addressbooks/user1', - 200 => array( - '{http://calendarserver.org/ns/}me-card' => null, - ), - ), - $result - ); + $this->assertEquals(200, $response->getStatus()); } - function testUpdatePropertiesMeCardBadValue() { - - $result = $this->server->updateProperties('addressbooks/user1', array( - '{http://calendarserver.org/ns/}me-card' => new DAV\Property\HrefList(array()), - )); - - $this->assertEquals( - array( - 'href' => 'addressbooks/user1', - 400 => array( - '{http://calendarserver.org/ns/}me-card' => null, - ), - ), - $result - ); - - } } |