summaryrefslogtreecommitdiffstats
path: root/tests/lib/files
diff options
context:
space:
mode:
authorVincent Petry <pvince81@owncloud.com>2014-03-07 11:25:29 +0100
committerVincent Petry <pvince81@owncloud.com>2014-03-21 10:23:56 +0100
commiteacb4b3f3ea7d5b8cf2458b2b9ffd22ec7bb7c3a (patch)
tree2dbcae4e7ae911e4487829a3dcdd1a216351c844 /tests/lib/files
parenta70b99ff62e85208144dc06bb19737c0b602bf4f (diff)
downloadnextcloud-server-eacb4b3f3ea7d5b8cf2458b2b9ffd22ec7bb7c3a.tar.gz
nextcloud-server-eacb4b3f3ea7d5b8cf2458b2b9ffd22ec7bb7c3a.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/lib/files')
-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 87bafb64d41..e9727bab2d9 100644
--- a/tests/lib/files/storage/wrapper/quota.php
+++ b/tests/lib/files/storage/wrapper/quota.php
@@ -50,6 +50,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+');