diff options
author | Robin Appelman <icewind@owncloud.com> | 2015-02-13 17:59:47 +0100 |
---|---|---|
committer | Robin Appelman <icewind@owncloud.com> | 2015-02-13 18:00:01 +0100 |
commit | 7bfe476030764f851d92f5c80ae8b798d074210b (patch) | |
tree | c30f7a641a72d590dee739c94e63653e21c6d8e0 /tests | |
parent | 9abaa0cc615ba5326a3990ad79b94e46db423cf2 (diff) | |
download | nextcloud-server-7bfe476030764f851d92f5c80ae8b798d074210b.tar.gz nextcloud-server-7bfe476030764f851d92f5c80ae8b798d074210b.zip |
add unit test for webdav quota
Diffstat (limited to 'tests')
-rw-r--r-- | tests/lib/connector/sabre/directory.php | 30 |
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 + } } |