summaryrefslogtreecommitdiffstats
path: root/tests/lib
diff options
context:
space:
mode:
authorRobin Appelman <icewind@owncloud.com>2012-09-23 15:25:03 +0200
committerRobin Appelman <icewind@owncloud.com>2012-09-23 15:25:03 +0200
commitdcf995fff3ecc2780d3187744397461d1a14c041 (patch)
tree27105e8e3ec72ba5204b00dbb78a8d33ac43e537 /tests/lib
parent4d2669f6b3ab9f4fcb6687b5d9c59d6589f8db0b (diff)
downloadnextcloud-server-dcf995fff3ecc2780d3187744397461d1a14c041.tar.gz
nextcloud-server-dcf995fff3ecc2780d3187744397461d1a14c041.zip
add Cache::getFolderContent
Diffstat (limited to 'tests/lib')
-rw-r--r--tests/lib/files/cache/cache.php23
1 files changed, 23 insertions, 0 deletions
diff --git a/tests/lib/files/cache/cache.php b/tests/lib/files/cache/cache.php
index 168489a7213..9f35cd889ac 100644
--- a/tests/lib/files/cache/cache.php
+++ b/tests/lib/files/cache/cache.php
@@ -78,6 +78,29 @@ class Cache extends \UnitTestCase {
$this->assertEqual(array('size' => 12, 'mtime' => 15), FileCache::get($file1));
}
+ public function testFolder() {
+ $file1 = $this->createPath('folder');
+ $file2 = $this->createPath('folder/bar');
+ $file3 = $this->createPath('folder/foo');
+ $data1 = array('size' => 100, 'mtime' => 50, 'mimetype' => 'foo/folder');
+ $fileData = array();
+ $fileData['bar'] = array('size' => 1000, 'mtime' => 20, 'mimetype' => 'foo/file');
+ $fileData['foo'] = array('size' => 20, 'mtime' => 25, 'mimetype' => 'foo/file');
+
+ FileCache::put($file1, $data1);
+ FileCache::put($file2, $fileData['bar']);
+ FileCache::put($file3, $fileData['foo']);
+
+ $content = FileCache::getFolderContents($file1);
+ $this->assertEqual(count($content), 2);
+ foreach ($content as $cachedData) {
+ $data = $fileData[$cachedData['name']];
+ foreach ($data as $name => $value) {
+ $this->assertEqual($value, $cachedData[$name]);
+ }
+ }
+ }
+
public function tearDown() {
FileCache::removeStorage($this->storage);
}