summaryrefslogtreecommitdiffstats
path: root/tests
diff options
context:
space:
mode:
authorRobin Appelman <robin@icewind.nl>2017-06-15 13:59:06 +0200
committerRobin Appelman <robin@icewind.nl>2017-06-15 13:59:06 +0200
commitfa817599170e81b0eb28cb59446c32f0b5645f03 (patch)
tree62ec6b77ecff2bd91d74797b96f01c6b5cbab562 /tests
parenta74901fce17da6d88dbb82373fff523b834d692d (diff)
downloadnextcloud-server-fa817599170e81b0eb28cb59446c32f0b5645f03.tar.gz
nextcloud-server-fa817599170e81b0eb28cb59446c32f0b5645f03.zip
fix moving folders out of a cache jail
Signed-off-by: Robin Appelman <robin@icewind.nl>
Diffstat (limited to 'tests')
-rw-r--r--tests/lib/Files/Cache/Wrapper/CacheJailTest.php50
1 files changed, 50 insertions, 0 deletions
diff --git a/tests/lib/Files/Cache/Wrapper/CacheJailTest.php b/tests/lib/Files/Cache/Wrapper/CacheJailTest.php
index e3043c50d57..f26e3a59f1c 100644
--- a/tests/lib/Files/Cache/Wrapper/CacheJailTest.php
+++ b/tests/lib/Files/Cache/Wrapper/CacheJailTest.php
@@ -8,6 +8,7 @@
namespace Test\Files\Cache\Wrapper;
+use OC\Files\Cache\Wrapper\CacheJail;
use Test\Files\Cache\CacheTest;
/**
@@ -80,4 +81,53 @@ class CacheJailTest extends CacheTest {
//not supported
$this->assertTrue(true);
}
+
+ function testMoveFromJail() {
+ $folderData = array('size' => 100, 'mtime' => 50, 'mimetype' => 'httpd/unix-directory');
+
+ $this->sourceCache->put('source', $folderData);
+ $this->sourceCache->put('source/foo', $folderData);
+ $this->sourceCache->put('source/foo/bar', $folderData);
+ $this->sourceCache->put('target', $folderData);
+
+ $jail = new CacheJail($this->sourceCache, 'source');
+
+ $this->sourceCache->moveFromCache($jail, 'foo', 'target/foo');
+
+ $this->assertTrue($this->sourceCache->inCache('target/foo'));
+ $this->assertTrue($this->sourceCache->inCache('target/foo/bar'));
+ }
+
+ function testMoveToJail() {
+ $folderData = array('size' => 100, 'mtime' => 50, 'mimetype' => 'httpd/unix-directory');
+
+ $this->sourceCache->put('source', $folderData);
+ $this->sourceCache->put('source/foo', $folderData);
+ $this->sourceCache->put('source/foo/bar', $folderData);
+ $this->sourceCache->put('target', $folderData);
+
+ $jail = new CacheJail($this->sourceCache, 'target');
+
+ $jail->moveFromCache($this->sourceCache, 'source/foo', 'foo');
+
+ $this->assertTrue($this->sourceCache->inCache('target/foo'));
+ $this->assertTrue($this->sourceCache->inCache('target/foo/bar'));
+ }
+
+ function testMoveBetweenJail() {
+ $folderData = array('size' => 100, 'mtime' => 50, 'mimetype' => 'httpd/unix-directory');
+
+ $this->sourceCache->put('source', $folderData);
+ $this->sourceCache->put('source/foo', $folderData);
+ $this->sourceCache->put('source/foo/bar', $folderData);
+ $this->sourceCache->put('target', $folderData);
+
+ $jail = new CacheJail($this->sourceCache, 'target');
+ $sourceJail = new CacheJail($this->sourceCache, 'source');
+
+ $jail->moveFromCache($sourceJail, 'foo', 'foo');
+
+ $this->assertTrue($this->sourceCache->inCache('target/foo'));
+ $this->assertTrue($this->sourceCache->inCache('target/foo/bar'));
+ }
}