summaryrefslogtreecommitdiffstats
path: root/tests/lib/files/cache/cache.php
diff options
context:
space:
mode:
Diffstat (limited to 'tests/lib/files/cache/cache.php')
-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);
}