summaryrefslogtreecommitdiffstats
path: root/apps/dav/tests
diff options
context:
space:
mode:
authorVincent Petry <pvince81@owncloud.com>2016-02-24 10:39:04 +0100
committerVincent Petry <pvince81@owncloud.com>2016-02-29 14:36:20 +0100
commit11215f4e275f7e7d1aafdb8af440550d27562ad8 (patch)
tree3d133edb995e6e989d27ad02ef1e518ecb8fea52 /apps/dav/tests
parenta38e8b6436ccfe173b4d368d094753c71bdbd69f (diff)
downloadnextcloud-server-11215f4e275f7e7d1aafdb8af440550d27562ad8.tar.gz
nextcloud-server-11215f4e275f7e7d1aafdb8af440550d27562ad8.zip
Return -3 for unlimited quota
Returns -3 for unlimited quota in Webdav response. Also adjusted personal page to show unlimited quota when set.
Diffstat (limited to 'apps/dav/tests')
-rw-r--r--apps/dav/tests/unit/connector/sabre/directory.php39
1 files changed, 36 insertions, 3 deletions
diff --git a/apps/dav/tests/unit/connector/sabre/directory.php b/apps/dav/tests/unit/connector/sabre/directory.php
index 317e089925b..c4ddc38b3e1 100644
--- a/apps/dav/tests/unit/connector/sabre/directory.php
+++ b/apps/dav/tests/unit/connector/sabre/directory.php
@@ -199,15 +199,48 @@ class Directory extends \Test\TestCase {
$dir->getChild('.');
}
- public function testGetQuotaInfo() {
+ public function testGetQuotaInfoUnlimited() {
$storage = $this->getMockBuilder('\OC\Files\Storage\Wrapper\Quota')
->disableOriginalConstructor()
->getMock();
+ $storage->expects($this->any())
+ ->method('instanceOfStorage')
+ ->will($this->returnValueMap([
+ '\OC\Files\Storage\Shared' => false,
+ '\OC\Files\Storage\Wrapper\Quota' => false,
+ ]));
+
+ $storage->expects($this->never())
+ ->method('getQuota');
+
$storage->expects($this->once())
+ ->method('free_space')
+ ->will($this->returnValue(800));
+
+ $this->info->expects($this->once())
+ ->method('getSize')
+ ->will($this->returnValue(200));
+
+ $this->info->expects($this->once())
+ ->method('getStorage')
+ ->will($this->returnValue($storage));
+
+ $dir = new \OCA\DAV\Connector\Sabre\Directory($this->view, $this->info);
+ $this->assertEquals([200, -3], $dir->getQuotaInfo()); //200 used, unlimited
+ }
+
+ public function testGetQuotaInfoSpecific() {
+ $storage = $this->getMockBuilder('\OC\Files\Storage\Wrapper\Quota')
+ ->disableOriginalConstructor()
+ ->getMock();
+
+ $storage->expects($this->any())
->method('instanceOfStorage')
- ->with('\OC\Files\Storage\Wrapper\Quota')
- ->will($this->returnValue(true));
+ ->will($this->returnValueMap([
+ ['\OC\Files\Storage\Shared', false],
+ ['\OC\Files\Storage\Wrapper\Quota', true],
+ ]));
$storage->expects($this->once())
->method('getQuota')