From c26dede97f626b52b7bf8962ed55d1dbda86abe8 Mon Sep 17 00:00:00 2001 From: Hilmar R Date: Sun, 28 Feb 2021 21:06:16 +0100 Subject: get dev --- .../sabre/dav/tests/Sabre/DAV/ServerPropsTest.php | 194 --------------------- 1 file changed, 194 deletions(-) delete mode 100644 vendor/sabre/dav/tests/Sabre/DAV/ServerPropsTest.php (limited to 'vendor/sabre/dav/tests/Sabre/DAV/ServerPropsTest.php') diff --git a/vendor/sabre/dav/tests/Sabre/DAV/ServerPropsTest.php b/vendor/sabre/dav/tests/Sabre/DAV/ServerPropsTest.php deleted file mode 100644 index cd1ccfa53..000000000 --- a/vendor/sabre/dav/tests/Sabre/DAV/ServerPropsTest.php +++ /dev/null @@ -1,194 +0,0 @@ -server->addPlugin(new Locks\Plugin(new Locks\Backend\File(SABRE_TEMPDIR.'/.locksdb'))); - } - - public function teardown(): void - { - parent::tearDown(); - if (file_exists(SABRE_TEMPDIR.'../.locksdb')) { - unlink(SABRE_TEMPDIR.'../.locksdb'); - } - } - - private function sendRequest($body, $path = '/', $headers = ['Depth' => '0']) - { - $request = new HTTP\Request('PROPFIND', $path, $headers, $body); - - $this->server->httpRequest = $request; - $this->server->exec(); - } - - public function testPropFindEmptyBody() - { - $this->sendRequest(''); - $this->assertEquals(207, $this->response->status); - - $this->assertEquals([ - 'X-Sabre-Version' => [Version::VERSION], - 'Content-Type' => ['application/xml; charset=utf-8'], - 'DAV' => ['1, 3, extended-mkcol, 2'], - 'Vary' => ['Brief,Prefer'], - ], - $this->response->getHeaders() - ); - - $body = preg_replace("/xmlns(:[A-Za-z0-9_])?=(\"|\')DAV:(\"|\')/", 'xmlns\\1="urn:DAV"', $this->response->getBodyAsString()); - $xml = simplexml_load_string($body); - $xml->registerXPathNamespace('d', 'urn:DAV'); - - list($data) = $xml->xpath('/d:multistatus/d:response/d:href'); - $this->assertEquals('/', (string) $data, 'href element should have been /'); - - $data = $xml->xpath('/d:multistatus/d:response/d:propstat/d:prop/d:resourcetype'); - $this->assertEquals(1, count($data)); - } - - public function testPropFindEmptyBodyFile() - { - $this->sendRequest('', '/test2.txt', []); - $this->assertEquals(207, $this->response->status); - - $this->assertEquals([ - 'X-Sabre-Version' => [Version::VERSION], - 'Content-Type' => ['application/xml; charset=utf-8'], - 'DAV' => ['1, 3, extended-mkcol, 2'], - 'Vary' => ['Brief,Prefer'], - ], - $this->response->getHeaders() - ); - - $body = preg_replace("/xmlns(:[A-Za-z0-9_])?=(\"|\')DAV:(\"|\')/", 'xmlns\\1="urn:DAV"', $this->response->getBodyAsString()); - $xml = simplexml_load_string($body); - $xml->registerXPathNamespace('d', 'urn:DAV'); - - list($data) = $xml->xpath('/d:multistatus/d:response/d:href'); - $this->assertEquals('/test2.txt', (string) $data, 'href element should have been /test2.txt'); - - $data = $xml->xpath('/d:multistatus/d:response/d:propstat/d:prop/d:getcontentlength'); - $this->assertEquals(1, count($data)); - } - - public function testSupportedLocks() - { - $xml = ' - - - - -'; - - $this->sendRequest($xml); - - $body = preg_replace("/xmlns(:[A-Za-z0-9_])?=(\"|\')DAV:(\"|\')/", 'xmlns\\1="urn:DAV"', $this->response->getBodyAsString()); - $xml = simplexml_load_string($body); - $xml->registerXPathNamespace('d', 'urn:DAV'); - - $data = $xml->xpath('/d:multistatus/d:response/d:propstat/d:prop/d:supportedlock/d:lockentry'); - $this->assertEquals(2, count($data), 'We expected two \'d:lockentry\' tags'); - - $data = $xml->xpath('/d:multistatus/d:response/d:propstat/d:prop/d:supportedlock/d:lockentry/d:lockscope'); - $this->assertEquals(2, count($data), 'We expected two \'d:lockscope\' tags'); - - $data = $xml->xpath('/d:multistatus/d:response/d:propstat/d:prop/d:supportedlock/d:lockentry/d:locktype'); - $this->assertEquals(2, count($data), 'We expected two \'d:locktype\' tags'); - - $data = $xml->xpath('/d:multistatus/d:response/d:propstat/d:prop/d:supportedlock/d:lockentry/d:lockscope/d:shared'); - $this->assertEquals(1, count($data), 'We expected a \'d:shared\' tag'); - - $data = $xml->xpath('/d:multistatus/d:response/d:propstat/d:prop/d:supportedlock/d:lockentry/d:lockscope/d:exclusive'); - $this->assertEquals(1, count($data), 'We expected a \'d:exclusive\' tag'); - - $data = $xml->xpath('/d:multistatus/d:response/d:propstat/d:prop/d:supportedlock/d:lockentry/d:locktype/d:write'); - $this->assertEquals(2, count($data), 'We expected two \'d:write\' tags'); - } - - public function testLockDiscovery() - { - $xml = ' - - - - -'; - - $this->sendRequest($xml); - - $body = preg_replace("/xmlns(:[A-Za-z0-9_])?=(\"|\')DAV:(\"|\')/", 'xmlns\\1="urn:DAV"', $this->response->getBodyAsString()); - $xml = simplexml_load_string($body); - $xml->registerXPathNamespace('d', 'urn:DAV'); - - $data = $xml->xpath('/d:multistatus/d:response/d:propstat/d:prop/d:lockdiscovery'); - $this->assertEquals(1, count($data), 'We expected a \'d:lockdiscovery\' tag'); - } - - public function testUnknownProperty() - { - $xml = ' - - - - -'; - - $this->sendRequest($xml); - $body = preg_replace("/xmlns(:[A-Za-z0-9_])?=(\"|\')DAV:(\"|\')/", 'xmlns\\1="urn:DAV"', $this->response->getBodyAsString()); - $xml = simplexml_load_string($body); - $xml->registerXPathNamespace('d', 'urn:DAV'); - $pathTests = [ - '/d:multistatus', - '/d:multistatus/d:response', - '/d:multistatus/d:response/d:propstat', - '/d:multistatus/d:response/d:propstat/d:status', - '/d:multistatus/d:response/d:propstat/d:prop', - '/d:multistatus/d:response/d:propstat/d:prop/d:macaroni', - ]; - foreach ($pathTests as $test) { - $this->assertTrue(true == count($xml->xpath($test)), 'We expected the '.$test.' element to appear in the response, we got: '.$body); - } - - $val = $xml->xpath('/d:multistatus/d:response/d:propstat/d:status'); - $this->assertEquals(1, count($val), $body); - $this->assertEquals('HTTP/1.1 404 Not Found', (string) $val[0]); - } - - public function testParsePropPatchRequest() - { - $body = ' - - somevalue - - removeme - -'; - - $result = $this->server->xml->parse($body); - $this->assertEquals([ - '{http://sabredav.org/NS/test}someprop' => 'somevalue', - '{http://sabredav.org/NS/test}someprop2' => null, - '{http://sabredav.org/NS/test}someprop3' => null, - ], $result->properties); - } -} -- cgit v1.2.3