Welcome to mirror list, hosted at ThFree Co, Russian Federation.

github.com/nextcloud/server.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
path: root/tests
diff options
context:
space:
mode:
authorVincent Petry <pvince81@owncloud.com>2014-03-19 22:07:11 +0400
committerVincent Petry <pvince81@owncloud.com>2014-03-19 22:07:11 +0400
commit66bc0f0848846bce3680b79da4209d42620f1b8d (patch)
treea40ca59c2f0fffe79f6ca9e014eb129c2473e3d6 /tests
parent6252c248c23661beef6484cf1ffa24db406e28ae (diff)
Still return quota value when free space is unknown
Fixed the quota storage wrapper to correctly return the quota value when the free space is not known (which usually happens when the disk_free_space function is disabled)
Diffstat (limited to 'tests')
-rw-r--r--tests/lib/files/storage/wrapper/quota.php18
1 files changed, 18 insertions, 0 deletions
diff --git a/tests/lib/files/storage/wrapper/quota.php b/tests/lib/files/storage/wrapper/quota.php
index bd2c69a7396..777529fd85e 100644
--- a/tests/lib/files/storage/wrapper/quota.php
+++ b/tests/lib/files/storage/wrapper/quota.php
@@ -61,6 +61,24 @@ class Quota extends \Test\Files\Storage\Storage {
$this->assertEquals(6, $instance->free_space(''));
}
+ public function testFreeSpaceWithUnknownDiskSpace() {
+ $storage = $this->getMock(
+ '\OC\Files\Storage\Local',
+ array('free_space'),
+ array(array('datadir' => $this->tmpDir))
+ );
+ $storage->expects($this->any())
+ ->method('free_space')
+ ->will($this->returnValue(-2));
+ $storage->getScanner()->scan('');
+
+ $instance = new \OC\Files\Storage\Wrapper\Quota(array('storage' => $storage, 'quota' => 9));
+ $instance->getCache()->put(
+ '', array('size' => 3, 'unencrypted_size' => 0)
+ );
+ $this->assertEquals(6, $instance->free_space(''));
+ }
+
public function testFreeSpaceWithUsedSpaceAndEncryption() {
$instance = $this->getLimitedStorage(9);
$instance->getCache()->put(