summaryrefslogtreecommitdiffstats
path: root/tests
diff options
context:
space:
mode:
authorRobin Appelman <icewind@owncloud.com>2012-11-02 22:25:33 +0100
committerRobin Appelman <icewind@owncloud.com>2012-11-02 22:25:33 +0100
commit8a6bb7965d96b1c4297da8f5dbc9644fec7aeb0f (patch)
treecf5ddabe9622d3d988d1ac6cd6175a9e277fec82 /tests
parente312c142dc448e24d222205c0835421409b3de80 (diff)
downloadnextcloud-server-8a6bb7965d96b1c4297da8f5dbc9644fec7aeb0f.tar.gz
nextcloud-server-8a6bb7965d96b1c4297da8f5dbc9644fec7aeb0f.zip
add Cache::move
Diffstat (limited to 'tests')
-rw-r--r--tests/lib/files/cache/cache.php26
1 files changed, 26 insertions, 0 deletions
diff --git a/tests/lib/files/cache/cache.php b/tests/lib/files/cache/cache.php
index 4f22e9bd1d9..9c469aa9374 100644
--- a/tests/lib/files/cache/cache.php
+++ b/tests/lib/files/cache/cache.php
@@ -149,6 +149,32 @@ class Cache extends \UnitTestCase {
$this->assertEquals(2, count($this->cache->searchByMime('foo/file')));
}
+ function testMove() {
+ $file1 = 'folder';
+ $file2 = 'folder/bar';
+ $file3 = 'folder/foo';
+ $file4 = 'folder/foo/1';
+ $file5 = 'folder/foo/2';
+ $data = array('size' => 100, 'mtime' => 50, 'mimetype' => 'foo/bar');
+
+ $this->cache->put($file1, $data);
+ $this->cache->put($file2, $data);
+ $this->cache->put($file3, $data);
+ $this->cache->put($file4, $data);
+ $this->cache->put($file5, $data);
+
+ $this->cache->move('folder/foo', 'folder/foobar');
+
+ $this->assertFalse($this->cache->inCache('folder/foo'));
+ $this->assertFalse($this->cache->inCache('folder/foo/1'));
+ $this->assertFalse($this->cache->inCache('folder/foo/2'));
+
+ $this->assertTrue($this->cache->inCache('folder/bar'));
+ $this->assertTrue($this->cache->inCache('folder/foobar'));
+ $this->assertTrue($this->cache->inCache('folder/foobar/1'));
+ $this->assertTrue($this->cache->inCache('folder/foobar/2'));
+ }
+
public function tearDown() {
$this->cache->clear();
}