diff options
Diffstat (limited to 'vendor/sabre/dav/tests/Sabre/DAV/Property')
7 files changed, 0 insertions, 773 deletions
diff --git a/vendor/sabre/dav/tests/Sabre/DAV/Property/GetLastModifiedTest.php b/vendor/sabre/dav/tests/Sabre/DAV/Property/GetLastModifiedTest.php deleted file mode 100644 index de8ca1283..000000000 --- a/vendor/sabre/dav/tests/Sabre/DAV/Property/GetLastModifiedTest.php +++ /dev/null @@ -1,75 +0,0 @@ -<?php - -namespace Sabre\DAV\Property; - -use Sabre\DAV; -use Sabre\HTTP; - -class GetLastModifiedTest extends \PHPUnit_Framework_TestCase { - - function testConstructDateTime() { - - $dt = new \DateTime('2010-03-14 16:35', new \DateTimeZone('UTC')); - $lastMod = new GetLastModified($dt); - $this->assertEquals($dt->format(\DateTime::ATOM), $lastMod->getTime()->format(\DateTime::ATOM)); - - } - - function testConstructString() { - - $dt = new \DateTime('2010-03-14 16:35', new \DateTimeZone('UTC')); - $lastMod = new GetLastModified('2010-03-14 16:35'); - $this->assertEquals($dt->format(\DateTime::ATOM), $lastMod->getTime()->format(\DateTime::ATOM)); - - } - - function testConstructInt() { - - $dt = new \DateTime('2010-03-14 16:35', new \DateTimeZone('UTC')); - $lastMod = new GetLastModified((int)$dt->format('U')); - $this->assertEquals($dt->format(\DateTime::ATOM), $lastMod->getTime()->format(\DateTime::ATOM)); - - } - - function testSerialize() { - - $dt = new \DateTime('2010-03-14 16:35', new \DateTimeZone('UTC')); - $lastMod = new GetLastModified($dt); - - $doc = new \DOMDocument(); - $root = $doc->createElement('d:getlastmodified'); - $root->setAttribute('xmlns:d','DAV:'); - - $doc->appendChild($root); - $server = new DAV\Server(); - - $lastMod->serialize($server, $root); - - $xml = $doc->saveXML(); - - /* - $this->assertEquals( -'<?xml version="1.0"?> -<d:getlastmodified xmlns:d="DAV:" xmlns:b="urn:uuid:c2f41010-65b3-11d1-a29f-00aa00c14882/" b:dt="dateTime.rfc1123">' . -HTTP\Util::toHTTPDate($dt) . -'</d:getlastmodified> -', $xml); - */ - $this->assertEquals( -'<?xml version="1.0"?> -<d:getlastmodified xmlns:d="DAV:">' . -HTTP\Util::toHTTPDate($dt) . -'</d:getlastmodified> -', $xml); - - $ok = false; - try { - GetLastModified::unserialize(DAV\XMLUtil::loadDOMDocument($xml)->firstChild); - } catch (DAV\Exception $e) { - $ok = true; - } - if (!$ok) $this->markTestFailed('Unserialize should not be supported'); - - } - -} diff --git a/vendor/sabre/dav/tests/Sabre/DAV/Property/HrefListTest.php b/vendor/sabre/dav/tests/Sabre/DAV/Property/HrefListTest.php deleted file mode 100644 index fe2bc81f9..000000000 --- a/vendor/sabre/dav/tests/Sabre/DAV/Property/HrefListTest.php +++ /dev/null @@ -1,91 +0,0 @@ -<?php - -namespace Sabre\DAV\Property; -use Sabre\DAV; - -class HrefListTest extends \PHPUnit_Framework_TestCase { - - function testConstruct() { - - $href = new HrefList(array('foo','bar')); - $this->assertEquals(array('foo','bar'),$href->getHrefs()); - - } - - function testSerialize() { - - $href = new HrefList(array('foo','bar')); - $this->assertEquals(array('foo','bar'),$href->getHrefs()); - - $doc = new \DOMDocument(); - $root = $doc->createElement('d:anything'); - $root->setAttribute('xmlns:d','DAV:'); - - $doc->appendChild($root); - $server = new DAV\Server(); - $server->setBaseUri('/bla/'); - - $href->serialize($server, $root); - - $xml = $doc->saveXML(); - - $this->assertEquals( -'<?xml version="1.0"?> -<d:anything xmlns:d="DAV:"><d:href>/bla/foo</d:href><d:href>/bla/bar</d:href></d:anything> -', $xml); - - } - - function testSerializeNoPrefix() { - - $href = new HrefList(array('foo','bar'), false); - $this->assertEquals(array('foo','bar'),$href->getHrefs()); - - $doc = new \DOMDocument(); - $root = $doc->createElement('d:anything'); - $root->setAttribute('xmlns:d','DAV:'); - - $doc->appendChild($root); - $server = new DAV\Server(); - $server->setBaseUri('/bla/'); - - $href->serialize($server, $root); - - $xml = $doc->saveXML(); - - $this->assertEquals( -'<?xml version="1.0"?> -<d:anything xmlns:d="DAV:"><d:href>foo</d:href><d:href>bar</d:href></d:anything> -', $xml); - - } - - function testUnserialize() { - - $xml = '<?xml version="1.0"?> -<d:anything xmlns:d="urn:DAV"><d:href>/bla/foo</d:href><d:href>/bla/bar</d:href></d:anything> -'; - - $dom = new \DOMDocument(); - $dom->loadXML($xml); - - $href = HrefList::unserialize($dom->firstChild); - $this->assertEquals(array('/bla/foo','/bla/bar'),$href->getHrefs()); - - } - - function testUnserializeIncompatible() { - - $xml = '<?xml version="1.0"?> -<d:anything xmlns:d="urn:DAV"><d:href2>/bla/foo</d:href2></d:anything> -'; - - $dom = new \DOMDocument(); - $dom->loadXML($xml); - - $href = HrefList::unserialize($dom->firstChild); - $this->assertEquals(array(), $href->getHrefs()); - - } - -} diff --git a/vendor/sabre/dav/tests/Sabre/DAV/Property/HrefTest.php b/vendor/sabre/dav/tests/Sabre/DAV/Property/HrefTest.php deleted file mode 100644 index e5607f51b..000000000 --- a/vendor/sabre/dav/tests/Sabre/DAV/Property/HrefTest.php +++ /dev/null @@ -1,119 +0,0 @@ -<?php - -namespace Sabre\DAV\Property; - -use Sabre\DAV; - -class HrefTest extends \PHPUnit_Framework_TestCase { - - function testConstruct() { - - $href = new Href('path'); - $this->assertEquals('path',$href->getHref()); - - } - - function testSerialize() { - - $href = new Href('path'); - $this->assertEquals('path',$href->getHref()); - - $doc = new \DOMDocument(); - $root = $doc->createElement('d:anything'); - $root->setAttribute('xmlns:d','DAV:'); - - $doc->appendChild($root); - $server = new DAV\Server(); - $server->setBaseUri('/bla/'); - - $href->serialize($server, $root); - - $xml = $doc->saveXML(); - - $this->assertEquals( -'<?xml version="1.0"?> -<d:anything xmlns:d="DAV:"><d:href>/bla/path</d:href></d:anything> -', $xml); - - } - - function testSerializeNoPrefix() { - - $href = new Href('path',false); - $this->assertEquals('path',$href->getHref()); - - $doc = new \DOMDocument(); - $root = $doc->createElement('d:anything'); - $root->setAttribute('xmlns:d','DAV:'); - - $doc->appendChild($root); - $server = new DAV\Server(); - $server->setBaseUri('/bla/'); - - $href->serialize($server, $root); - - $xml = $doc->saveXML(); - - $this->assertEquals( -'<?xml version="1.0"?> -<d:anything xmlns:d="DAV:"><d:href>path</d:href></d:anything> -', $xml); - - } - - function testUnserialize() { - - $xml = '<?xml version="1.0"?> -<d:anything xmlns:d="urn:DAV"><d:href>/bla/path</d:href></d:anything> -'; - - $dom = new \DOMDocument(); - $dom->loadXML($xml); - - $href = Href::unserialize($dom->firstChild); - $this->assertEquals('/bla/path',$href->getHref()); - - } - - function testUnserializeIncompatible() { - - $xml = '<?xml version="1.0"?> -<d:anything xmlns:d="urn:DAV"><d:href2>/bla/path</d:href2></d:anything> -'; - - $dom = new \DOMDocument(); - $dom->loadXML($xml); - - $href = Href::unserialize($dom->firstChild); - $this->assertNull($href); - - } - - /** - * This method tests if hrefs containing & are correctly encoded. - */ - function testSerializeEntity() { - - $href = new Href('http://example.org/?a&b', false); - $this->assertEquals('http://example.org/?a&b',$href->getHref()); - - $doc = new \DOMDocument(); - $root = $doc->createElement('d:anything'); - $root->setAttribute('xmlns:d','DAV:'); - - $doc->appendChild($root); - $server = new DAV\Server(); - $server->setBaseUri('/bla/'); - - $href->serialize($server, $root); - - $xml = $doc->saveXML(); - - $this->assertEquals( -'<?xml version="1.0"?> -<d:anything xmlns:d="DAV:"><d:href>http://example.org/?a&b</d:href></d:anything> -', $xml); - - } - -} diff --git a/vendor/sabre/dav/tests/Sabre/DAV/Property/ResourceTypeTest.php b/vendor/sabre/dav/tests/Sabre/DAV/Property/ResourceTypeTest.php deleted file mode 100644 index 8a579baec..000000000 --- a/vendor/sabre/dav/tests/Sabre/DAV/Property/ResourceTypeTest.php +++ /dev/null @@ -1,111 +0,0 @@ -<?php - -namespace Sabre\DAV\Property; - -use Sabre\DAV; - -class ResourceTypeTest extends \PHPUnit_Framework_TestCase { - - function testConstruct() { - - $resourceType = new ResourceType(array('{DAV:}collection')); - $this->assertEquals(array('{DAV:}collection'),$resourceType->getValue()); - - $resourceType = new ResourceType(DAV\Server::NODE_FILE); - $this->assertEquals(array(),$resourceType->getValue()); - - $resourceType = new ResourceType(DAV\Server::NODE_DIRECTORY); - $this->assertEquals(array('{DAV:}collection'),$resourceType->getValue()); - - $resourceType = new ResourceType('{DAV:}principal'); - $this->assertEquals(array('{DAV:}principal'),$resourceType->getValue()); - - } - - /** - * @depends testConstruct - */ - function testSerialize() { - - $resourceType = new ResourceType(array('{DAV:}collection','{DAV:}principal')); - - $doc = new \DOMDocument(); - $root = $doc->createElement('d:anything'); - $root->setAttribute('xmlns:d','DAV:'); - - $doc->appendChild($root); - $server = new DAV\Server(); - $resourceType->serialize($server, $root); - - $xml = $doc->saveXML(); - - $this->assertEquals( -'<?xml version="1.0"?> -<d:anything xmlns:d="DAV:"><d:collection/><d:principal/></d:anything> -', $xml); - - } - - /** - * @depends testSerialize - */ - function testSerializeCustomNS() { - - $resourceType = new ResourceType(array('{http://example.org/NS}article')); - - $doc = new \DOMDocument(); - $root = $doc->createElement('d:anything'); - $root->setAttribute('xmlns:d','DAV:'); - - $doc->appendChild($root); - $server = new DAV\Server(); - $resourceType->serialize($server, $root); - - $xml = $doc->saveXML(); - - $this->assertEquals( -'<?xml version="1.0"?> -<d:anything xmlns:d="DAV:"><custom:article xmlns:custom="http://example.org/NS"/></d:anything> -', $xml); - - } - - /** - * @depends testConstruct - */ - function testIs() { - - $resourceType = new ResourceType(array('{DAV:}collection','{DAV:}principal')); - $this->assertTrue($resourceType->is('{DAV:}collection')); - $this->assertFalse($resourceType->is('{DAV:}blabla')); - - } - - /** - * @depends testConstruct - */ - function testAdd() { - - $resourceType = new ResourceType(array('{DAV:}collection','{DAV:}principal')); - $resourceType->add('{DAV:}foo'); - $this->assertEquals(array('{DAV:}collection','{DAV:}principal','{DAV:}foo'), $resourceType->getValue()); - - } - - /** - * @depends testConstruct - */ - function testUnserialize() { - - $xml ='<?xml version="1.0"?> -<d:anything xmlns:d="DAV:"><d:collection/><d:principal/></d:anything> -'; - - $dom = DAV\XMLUtil::loadDOMDocument($xml); - - $resourceType = ResourceType::unserialize($dom->firstChild); - $this->assertEquals(array('{DAV:}collection','{DAV:}principal'),$resourceType->getValue()); - - } - -} diff --git a/vendor/sabre/dav/tests/Sabre/DAV/Property/ResponseListTest.php b/vendor/sabre/dav/tests/Sabre/DAV/Property/ResponseListTest.php deleted file mode 100644 index d13066b80..000000000 --- a/vendor/sabre/dav/tests/Sabre/DAV/Property/ResponseListTest.php +++ /dev/null @@ -1,19 +0,0 @@ -<?php - -namespace Sabre\DAV\Property; - -class ResponseListTest extends \PHPUnit_Framework_TestCase { - - /** - * This was the only part not yet covered by other tests, so I'm going to - * be lazy and (for now) only test this case. - * - * @expectedException InvalidArgumentException - */ - public function testInvalidArg() { - - $response = new ResponseList(array(1,2)); - - } - -} diff --git a/vendor/sabre/dav/tests/Sabre/DAV/Property/ResponseTest.php b/vendor/sabre/dav/tests/Sabre/DAV/Property/ResponseTest.php deleted file mode 100644 index 073cbb2ce..000000000 --- a/vendor/sabre/dav/tests/Sabre/DAV/Property/ResponseTest.php +++ /dev/null @@ -1,230 +0,0 @@ -<?php - -namespace Sabre\DAV\Property; - -use Sabre\DAV; - -class ResponseTest extends \PHPUnit_Framework_TestCase { - - function testSimple() { - - $innerProps = array( - 200 => array( - '{DAV:}displayname' => 'my file', - ), - 404 => array( - '{DAV:}owner' => null, - ) - ); - - $property = new Response('uri',$innerProps); - - $this->assertEquals('uri',$property->getHref()); - $this->assertEquals($innerProps,$property->getResponseProperties()); - - - } - - /** - * @depends testSimple - */ - function testSerialize() { - - $innerProps = array( - 200 => array( - '{DAV:}displayname' => 'my file', - ), - 404 => array( - '{DAV:}owner' => null, - ) - ); - - $property = new Response('uri',$innerProps); - - $doc = new \DOMDocument(); - $root = $doc->createElement('d:root'); - $root->setAttribute('xmlns:d','DAV:'); - - $doc->appendChild($root); - $server = new DAV\Server(); - - $property->serialize($server, $root); - - $xml = $doc->saveXML(); - - $this->assertEquals( -'<?xml version="1.0"?> -<d:root xmlns:d="DAV:">' . -'<d:response>' . -'<d:href>/uri</d:href>' . -'<d:propstat>' . -'<d:prop>' . -'<d:displayname>my file</d:displayname>' . -'</d:prop>' . -'<d:status>HTTP/1.1 200 OK</d:status>' . -'</d:propstat>' . -'<d:propstat>' . -'<d:prop>' . -'<d:owner/>' . -'</d:prop>' . -'<d:status>HTTP/1.1 404 Not Found</d:status>' . -'</d:propstat>' . -'</d:response>' . -'</d:root> -', $xml); - - } - - /** - * This one is specifically for testing properties with no namespaces, which is legal xml - * - * @depends testSerialize - */ - function testSerializeEmptyNamespace() { - - $innerProps = array( - 200 => array( - '{}propertyname' => 'value', - ), - ); - - $property = new Response('uri',$innerProps); - - $doc = new \DOMDocument(); - $root = $doc->createElement('d:root'); - $root->setAttribute('xmlns:d','DAV:'); - - $doc->appendChild($root); - $server = new DAV\Server(); - - $property->serialize($server, $root); - - $xml = $doc->saveXML(); - - $this->assertEquals( -'<?xml version="1.0"?> -<d:root xmlns:d="DAV:">' . -'<d:response>' . -'<d:href>/uri</d:href>' . -'<d:propstat>' . -'<d:prop>' . -'<propertyname xmlns="">value</propertyname>' . -'</d:prop>' . -'<d:status>HTTP/1.1 200 OK</d:status>' . -'</d:propstat>' . -'</d:response>' . -'</d:root> -', $xml); - - } - - /** - * This one is specifically for testing properties with no namespaces, which is legal xml - * - * @depends testSerialize - */ - function testSerializeCustomNamespace() { - - $innerProps = array( - 200 => array( - '{http://sabredav.org/NS/example}propertyname' => 'value', - ), - ); - - $property = new Response('uri',$innerProps); - - $doc = new \DOMDocument(); - $root = $doc->createElement('d:root'); - $root->setAttribute('xmlns:d','DAV:'); - - $doc->appendChild($root); - $server = new DAV\Server(); - - $property->serialize($server, $root); - - $xml = $doc->saveXML(); - - $this->assertEquals( -'<?xml version="1.0"?> -<d:root xmlns:d="DAV:">' . -'<d:response>' . -'<d:href>/uri</d:href>' . -'<d:propstat>' . -'<d:prop>' . -'<x2:propertyname xmlns:x2="http://sabredav.org/NS/example">value</x2:propertyname>' . -'</d:prop>' . -'<d:status>HTTP/1.1 200 OK</d:status>' . -'</d:propstat>' . -'</d:response>' . -'</d:root> -', $xml); - - } - - /** - * @depends testSerialize - */ - function testSerializeComplexProperty() { - - $innerProps = array( - 200 => array( - '{DAV:}link' => new Href('http://sabredav.org/', false) - ), - ); - - $property = new Response('uri',$innerProps); - - $doc = new \DOMDocument(); - $root = $doc->createElement('d:root'); - $root->setAttribute('xmlns:d','DAV:'); - - $doc->appendChild($root); - $server = new DAV\Server(); - - $property->serialize($server, $root); - - $xml = $doc->saveXML(); - - $this->assertEquals( -'<?xml version="1.0"?> -<d:root xmlns:d="DAV:">' . -'<d:response>' . -'<d:href>/uri</d:href>' . -'<d:propstat>' . -'<d:prop>' . -'<d:link><d:href>http://sabredav.org/</d:href></d:link>' . -'</d:prop>' . -'<d:status>HTTP/1.1 200 OK</d:status>' . -'</d:propstat>' . -'</d:response>' . -'</d:root> -', $xml); - - } - - /** - * @depends testSerialize - * @expectedException Sabre\DAV\Exception - */ - function testSerializeBreak() { - - $innerProps = array( - 200 => array( - '{DAV:}link' => new \STDClass() - ), - ); - - $property = new Response('uri',$innerProps); - - $doc = new \DOMDocument(); - $root = $doc->createElement('d:root'); - $root->setAttribute('xmlns:d','DAV:'); - - $doc->appendChild($root); - $server = new DAV\Server(); - - $property->serialize($server, $root); - - } - -} diff --git a/vendor/sabre/dav/tests/Sabre/DAV/Property/SupportedReportSetTest.php b/vendor/sabre/dav/tests/Sabre/DAV/Property/SupportedReportSetTest.php deleted file mode 100644 index 445e22ab3..000000000 --- a/vendor/sabre/dav/tests/Sabre/DAV/Property/SupportedReportSetTest.php +++ /dev/null @@ -1,128 +0,0 @@ -<?php - -namespace Sabre\DAV\Property; - -use Sabre\DAV; -use Sabre\HTTP; - -require_once 'Sabre/HTTP/ResponseMock.php'; -require_once 'Sabre/DAV/AbstractServer.php'; - -class SupportedReportSetTest extends DAV\AbstractServer { - - public function sendPROPFIND($body) { - - $serverVars = array( - 'REQUEST_URI' => '/', - 'REQUEST_METHOD' => 'PROPFIND', - 'HTTP_DEPTH' => '0', - ); - - $request = new HTTP\Request($serverVars); - $request->setBody($body); - - $this->server->httpRequest = ($request); - $this->server->exec(); - - } - - /** - * @covers Sabre\DAV\Property\SupportedReportSet - */ - function testNoReports() { - - $xml = '<?xml version="1.0"?> -<d:propfind xmlns:d="DAV:"> - <d:prop> - <d:supported-report-set /> - </d:prop> -</d:propfind>'; - - $this->sendPROPFIND($xml); - - $this->assertEquals('HTTP/1.1 207 Multi-Status',$this->response->status,'We expected a multi-status response. Full response body: ' . $this->response->body); - - $body = preg_replace("/xmlns(:[A-Za-z0-9_])?=(\"|\')DAV:(\"|\')/","xmlns\\1=\"urn:DAV\"",$this->response->body); - $xml = simplexml_load_string($body); - $xml->registerXPathNamespace('d','urn:DAV'); - - $data = $xml->xpath('/d:multistatus/d:response/d:propstat/d:prop'); - $this->assertEquals(1,count($data),'We expected 1 \'d:prop\' element'); - - $data = $xml->xpath('/d:multistatus/d:response/d:propstat/d:prop/d:supported-report-set'); - $this->assertEquals(1,count($data),'We expected 1 \'d:supported-report-set\' element'); - - $data = $xml->xpath('/d:multistatus/d:response/d:propstat/d:status'); - $this->assertEquals(1,count($data),'We expected 1 \'d:status\' element'); - - $this->assertEquals('HTTP/1.1 200 OK',(string)$data[0],'The status for this property should have been 200'); - - } - - /** - * @covers Sabre\DAV\Property\SupportedReportSet - * @depends testNoReports - */ - function testCustomReport() { - - // Intercepting the report property - $this->server->subscribeEvent('afterGetProperties',array($this,'addProp')); - - $xml = '<?xml version="1.0"?> -<d:propfind xmlns:d="DAV:"> - <d:prop> - <d:supported-report-set /> - </d:prop> -</d:propfind>'; - - $this->sendPROPFIND($xml); - - $this->assertEquals('HTTP/1.1 207 Multi-Status',$this->response->status,'We expected a multi-status response. Full response body: ' . $this->response->body); - - $body = preg_replace("/xmlns(:[A-Za-z0-9_])?=(\"|\')DAV:(\"|\')/","xmlns\\1=\"urn:DAV\"",$this->response->body); - $xml = simplexml_load_string($body); - $xml->registerXPathNamespace('d','urn:DAV'); - $xml->registerXPathNamespace('x','http://www.rooftopsolutions.nl/testnamespace'); - - $data = $xml->xpath('/d:multistatus/d:response/d:propstat/d:prop'); - $this->assertEquals(1,count($data),'We expected 1 \'d:prop\' element'); - - $data = $xml->xpath('/d:multistatus/d:response/d:propstat/d:prop/d:supported-report-set'); - $this->assertEquals(1,count($data),'We expected 1 \'d:supported-report-set\' element'); - - $data = $xml->xpath('/d:multistatus/d:response/d:propstat/d:prop/d:supported-report-set/d:supported-report'); - $this->assertEquals(2,count($data),'We expected 2 \'d:supported-report\' elements'); - - $data = $xml->xpath('/d:multistatus/d:response/d:propstat/d:prop/d:supported-report-set/d:supported-report/d:report'); - $this->assertEquals(2,count($data),'We expected 2 \'d:report\' elements'); - - $data = $xml->xpath('/d:multistatus/d:response/d:propstat/d:prop/d:supported-report-set/d:supported-report/d:report/x:myreport'); - $this->assertEquals(1,count($data),'We expected 1 \'x:myreport\' element. Full body: ' . $this->response->body); - - $data = $xml->xpath('/d:multistatus/d:response/d:propstat/d:prop/d:supported-report-set/d:supported-report/d:report/d:anotherreport'); - $this->assertEquals(1,count($data),'We expected 1 \'d:anotherreport\' element. Full body: ' . $this->response->body); - - $data = $xml->xpath('/d:multistatus/d:response/d:propstat/d:status'); - $this->assertEquals(1,count($data),'We expected 1 \'d:status\' element'); - - $this->assertEquals('HTTP/1.1 200 OK',(string)$data[0],'The status for this property should have been 200'); - - } - - /** - * This method is used as a callback for afterGetProperties - */ - function addProp($path, &$properties) { - - if (isset($properties[200]['{DAV:}supported-report-set'])) { - $properties[200]['{DAV:}supported-report-set']->addReport('{http://www.rooftopsolutions.nl/testnamespace}myreport'); - $properties[200]['{DAV:}supported-report-set']->addReport('{DAV:}anotherreport'); - } - - } - - - -} - -?> |