summaryrefslogtreecommitdiffstats
path: root/tests
diff options
context:
space:
mode:
authorVincent Petry <pvince81@owncloud.com>2013-11-18 17:39:52 +0100
committerVincent Petry <pvince81@owncloud.com>2013-11-18 18:17:25 +0100
commit3e2fd9942b4c0c3d8109a28d01dafdf830553609 (patch)
tree08310fb0345ca1a078441f9b7d23b405221eb591 /tests
parent44c2f9aad2b475303b3bebb39f38954cb3210751 (diff)
downloadnextcloud-server-3e2fd9942b4c0c3d8109a28d01dafdf830553609.tar.gz
nextcloud-server-3e2fd9942b4c0c3d8109a28d01dafdf830553609.zip
Root size for home storage is now size of "files" subdir
Fixes #4593
Diffstat (limited to 'tests')
-rw-r--r--tests/lib/files/cache/homecache.php26
1 files changed, 26 insertions, 0 deletions
diff --git a/tests/lib/files/cache/homecache.php b/tests/lib/files/cache/homecache.php
index ebf2b7270da..2fa7f1ba92e 100644
--- a/tests/lib/files/cache/homecache.php
+++ b/tests/lib/files/cache/homecache.php
@@ -92,4 +92,30 @@ class HomeCache extends \PHPUnit_Framework_TestCase {
$this->assertFalse($this->cache->inCache($dir1));
$this->assertFalse($this->cache->inCache($dir2));
}
+
+ public function testRootFolderSizeIsFilesSize() {
+ $dir1 = 'files';
+ $afile = 'test.txt';
+ $fileData = array();
+ $fileData[''] = array('size' => 1500, 'mtime' => 20, 'mimetype' => 'httpd/unix-directory');
+ $fileData[$dir1] = array('size' => 1000, 'mtime' => 20, 'mimetype' => 'httpd/unix-directory');
+ $fileData[$afile] = array('size' => 500, 'mtime' => 20);
+
+ $this->cache->put('', $fileData['']);
+ $this->cache->put($dir1, $fileData[$dir1]);
+
+ $this->assertTrue($this->cache->inCache($dir1));
+
+ // check that root size ignored the unknown sizes
+ $data = $this->cache->get('files');
+ $this->assertEquals(1000, $data['size']);
+ $data = $this->cache->get('');
+ $this->assertEquals(1000, $data['size']);
+
+ // clean up
+ $this->cache->remove('');
+ $this->cache->remove($dir1);
+
+ $this->assertFalse($this->cache->inCache($dir1));
+ }
}