summaryrefslogtreecommitdiffstats
path: root/tests
diff options
context:
space:
mode:
authorVincent Petry <pvince81@owncloud.com>2014-03-07 11:25:29 +0100
committerVincent Petry <pvince81@owncloud.com>2014-03-07 14:59:09 +0100
commit48d63a6278078d164774fd182f03ebba5e3c77ad (patch)
tree892f4baee51b2d74560555609bc927c052b57d50 /tests
parent7f24d42ca5f70e5ed48cf800f0a8f134b9445d2e (diff)
downloadnextcloud-server-48d63a6278078d164774fd182f03ebba5e3c77ad.tar.gz
nextcloud-server-48d63a6278078d164774fd182f03ebba5e3c77ad.zip
Return unencrypted_size of folder when queried
This fixes the "used space" to be based on the unencrypted size, not encrypted size, to be consistent with how quota/space is handled when encryption is enabled
Diffstat (limited to 'tests')
-rw-r--r--tests/lib/files/storage/wrapper/quota.php16
1 files changed, 16 insertions, 0 deletions
diff --git a/tests/lib/files/storage/wrapper/quota.php b/tests/lib/files/storage/wrapper/quota.php
index 43eae78415d..bd2c69a7396 100644
--- a/tests/lib/files/storage/wrapper/quota.php
+++ b/tests/lib/files/storage/wrapper/quota.php
@@ -53,6 +53,22 @@ class Quota extends \Test\Files\Storage\Storage {
$this->assertEquals(9, $instance->free_space(''));
}
+ public function testFreeSpaceWithUsedSpace() {
+ $instance = $this->getLimitedStorage(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(
+ '', array('size' => 7, 'unencrypted_size' => 3)
+ );
+ $this->assertEquals(6, $instance->free_space(''));
+ }
+
public function testFWriteNotEnoughSpace() {
$instance = $this->getLimitedStorage(9);
$stream = $instance->fopen('foo', 'w+');