diff --git a/lib/DAV/PropFind.php b/lib/DAV/PropFind.php index e9ffb07cbc..d59202da9b 100644 --- a/lib/DAV/PropFind.php +++ b/lib/DAV/PropFind.php @@ -53,8 +53,6 @@ public function __construct($path, array $properties, $depth = 0, $requestType = '{DAV:}getlastmodified', '{DAV:}getcontentlength', '{DAV:}resourcetype', - '{DAV:}quota-used-bytes', - '{DAV:}quota-available-bytes', '{DAV:}getetag', '{DAV:}getcontenttype', ]; diff --git a/tests/Sabre/DAV/Mock/QuotaCollection.php b/tests/Sabre/DAV/Mock/QuotaCollection.php new file mode 100644 index 0000000000..adaa61d1ad --- /dev/null +++ b/tests/Sabre/DAV/Mock/QuotaCollection.php @@ -0,0 +1,31 @@ +used, $this->available]; + } +} diff --git a/tests/Sabre/DAV/PropFindQuotaTest.php b/tests/Sabre/DAV/PropFindQuotaTest.php new file mode 100644 index 0000000000..3e62e3aa1c --- /dev/null +++ b/tests/Sabre/DAV/PropFindQuotaTest.php @@ -0,0 +1,79 @@ +tree = new Mock\QuotaCollection('root', [ + 'file1' => 'foo', + new Mock\Collection('dir', []), + ]); + } + + public function testPropFindAllprops() + { + $request = new HTTP\Request('PROPFIND', '/', ['Depth' => 0]); + $response = $this->request($request); + + $xml = $response->getBodyAsString(); + + self::assertSame(207, $response->getStatus()); + self::assertTrue(false === strpos($xml, 'quota-used-bytes')); + self::assertTrue(false === strpos($xml, 'quota-available-bytes')); + } + + public function testPropFindQuotaProps() + { + $this->tree->available = 123456789; + $this->tree->used = 98765; + + $xml = ' + + + + + +'; + + $request = new HTTP\Request('PROPFIND', '/', ['Depth' => 0], $xml); + $response = $this->request($request); + + $xml = $response->getBodyAsString(); + + self::assertSame(207, $response->getStatus()); + self::assertTrue(strpos($xml, '98765') > 0); + self::assertTrue(strpos($xml, '123456789') > 0); + } + + public function testPropFindQuotaPropsNotFound() + { + $xml = ' + + + + + +'; + + // Requested location does not implement iQuota interface + $request = new HTTP\Request('PROPFIND', '/dir', ['Depth' => 0], $xml); + $response = $this->request($request); + + $xml = $response->getBodyAsString(); + + self::assertSame(207, $response->getStatus()); + $expected = '' + .'HTTP/1.1 404 Not Found'; + self::assertTrue(strpos($xml, $expected) > 0); + } +}