diff options
author | Morris Jobke <hey@morrisjobke.de> | 2017-07-06 18:31:18 +0200 |
---|---|---|
committer | GitHub <noreply@github.com> | 2017-07-06 18:31:18 +0200 |
commit | b4a221f9beae44634931abb193198d02eda30fad (patch) | |
tree | 0b600b26112f8d00a9e74dd219f3aaf75285acfb /tests/lib/Files | |
parent | ad1d4d363fca28b34396bcfb605ba5336cf040f7 (diff) | |
parent | 601362e164632a1b68e896bd5359d0b7308eed4f (diff) | |
download | nextcloud-server-b4a221f9beae44634931abb193198d02eda30fad.tar.gz nextcloud-server-b4a221f9beae44634931abb193198d02eda30fad.zip |
Merge pull request #5424 from nextcloud/moveFromCache-from-shared
fix moving folders out of a cache jail
Diffstat (limited to 'tests/lib/Files')
-rw-r--r-- | tests/lib/Files/Cache/Wrapper/CacheJailTest.php | 50 |
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')); + } } |