diff --git a/tests/Sabre/DAV/ServerPropsTest.php b/tests/Sabre/DAV/ServerPropsTest.php index cd1ccfa534..dde7ccfa87 100644 --- a/tests/Sabre/DAV/ServerPropsTest.php +++ b/tests/Sabre/DAV/ServerPropsTest.php @@ -66,6 +66,38 @@ public function testPropFindEmptyBody() $this->assertEquals(1, count($data)); } + public function testPropFindEmptyBodyDepth1Custom() + { + // Add custom property to nodes. + $this->server->on('propFind', function (PropFind $propFind, INode $node) { + $propFind->set('{DAV:}ishidden', '1'); + }); + + $this->sendRequest('', '/', ['Depth' => 1]); + $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'); + + $data = $xml->xpath('/d:multistatus/d:response/d:propstat/d:prop/d:ishidden'); + $this->assertEquals(5, count($data), 'Response should contain 5 elements'); + + $data = $xml->xpath('/d:multistatus/d:response/d:propstat/d:prop/d:ishidden'); + foreach ($data as $prop) { + $this->assertEquals('1', $prop[0]); + } + } + public function testPropFindEmptyBodyFile() { $this->sendRequest('', '/test2.txt', []);