summaryrefslogtreecommitdiffstats
path: root/tests/lib
diff options
context:
space:
mode:
authorMorris Jobke <hey@morrisjobke.de>2015-02-18 00:18:47 +0100
committerMorris Jobke <hey@morrisjobke.de>2015-02-18 00:18:47 +0100
commit5d7d2adcbf3bad8d5c74007fcf132b7868c00437 (patch)
tree31dcba1c2f399fe102562fb835624ac044f12860 /tests/lib
parentc652d3077c0d26d4f7799e65a9ffaebb435b8cc1 (diff)
parent7bfe476030764f851d92f5c80ae8b798d074210b (diff)
downloadnextcloud-server-5d7d2adcbf3bad8d5c74007fcf132b7868c00437.tar.gz
nextcloud-server-5d7d2adcbf3bad8d5c74007fcf132b7868c00437.zip
Merge pull request #14207 from owncloud/propfind-optimize
Optimize quota calculation for propfind
Diffstat (limited to 'tests/lib')
-rw-r--r--tests/lib/connector/sabre/directory.php30
1 files changed, 30 insertions, 0 deletions
diff --git a/tests/lib/connector/sabre/directory.php b/tests/lib/connector/sabre/directory.php
index e9bfea81b77..599a6ca3f7c 100644
--- a/tests/lib/connector/sabre/directory.php
+++ b/tests/lib/connector/sabre/directory.php
@@ -155,4 +155,34 @@ class Test_OC_Connector_Sabre_Directory extends \Test\TestCase {
$nodes[1]->getProperties($properties)
);
}
+
+ public function testGetQuotaInfo() {
+ $storage = $this->getMockBuilder('\OC\Files\Storage\Wrapper\Quota')
+ ->disableOriginalConstructor()
+ ->getMock();
+
+ $storage->expects($this->once())
+ ->method('instanceOfStorage')
+ ->with('\OC\Files\Storage\Wrapper\Quota')
+ ->will($this->returnValue(true));
+
+ $storage->expects($this->once())
+ ->method('getQuota')
+ ->will($this->returnValue(1000));
+
+ $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 OC_Connector_Sabre_Directory($this->view, $this->info);
+ $this->assertEquals([200, 800], $dir->getQuotaInfo()); //200 used, 800 free
+ }
}