]> source.dussan.org Git - nextcloud-server.git/commitdiff
add unit test for webdav quota
authorRobin Appelman <icewind@owncloud.com>
Fri, 13 Feb 2015 16:59:47 +0000 (17:59 +0100)
committerRobin Appelman <icewind@owncloud.com>
Fri, 13 Feb 2015 17:00:01 +0000 (18:00 +0100)
tests/lib/connector/sabre/directory.php

index e9bfea81b779f7f985a0db607dabde7b4b89b787..599a6ca3f7c19dbfd934fc5e993c2f17a77090ef 100644 (file)
@@ -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
+       }
 }