diff options
author | Bjoern Schiessle <schiessle@owncloud.com> | 2015-05-21 14:06:45 +0200 |
---|---|---|
committer | Bjoern Schiessle <schiessle@owncloud.com> | 2015-05-21 14:06:45 +0200 |
commit | 38bceb0d744357fc25cf0353989aa59f1bdcf11c (patch) | |
tree | b8f42563f65ecf4195358af33260d6ca3cdbfa81 /tests | |
parent | 896130b68d4712ec9ced3561036bc435e7e5a2dc (diff) | |
download | nextcloud-server-38bceb0d744357fc25cf0353989aa59f1bdcf11c.tar.gz nextcloud-server-38bceb0d744357fc25cf0353989aa59f1bdcf11c.zip |
distinguish between source and target mount point to allow copy/rename between system wide mount points and user specific mountpoints
Diffstat (limited to 'tests')
-rw-r--r-- | tests/lib/encryption/keys/storage.php | 40 |
1 files changed, 28 insertions, 12 deletions
diff --git a/tests/lib/encryption/keys/storage.php b/tests/lib/encryption/keys/storage.php index e67103fb6aa..747c632dbe0 100644 --- a/tests/lib/encryption/keys/storage.php +++ b/tests/lib/encryption/keys/storage.php @@ -276,7 +276,7 @@ class StorageTest extends TestCase { /** * @dataProvider dataProviderCopyRename */ - public function testRenameKeys($source, $target, $systemWideMount, $expectedSource, $expectedTarget) { + public function testRenameKeys($source, $target, $systemWideMountSource, $systemWideMountTarget, $expectedSource, $expectedTarget) { $this->view->expects($this->any()) ->method('file_exists') ->willReturn(true); @@ -294,7 +294,12 @@ class StorageTest extends TestCase { ->will($this->returnCallback(array($this, 'getUidAndFilenameCallback'))); $this->util->expects($this->any()) ->method('isSystemWideMountPoint') - ->willReturn($systemWideMount); + ->willReturnCallback(function($path, $owner) use ($systemWideMountSource, $systemWideMountTarget) { + if(strpos($path, 'source.txt') !== false) { + return $systemWideMountSource; + } + return $systemWideMountTarget; + }); $this->storage->renameKeys($source, $target); } @@ -302,7 +307,7 @@ class StorageTest extends TestCase { /** * @dataProvider dataProviderCopyRename */ - public function testCopyKeys($source, $target, $systemWideMount, $expectedSource, $expectedTarget) { + public function testCopyKeys($source, $target, $systemWideMountSource, $systemWideMountTarget , $expectedSource, $expectedTarget) { $this->view->expects($this->any()) ->method('file_exists') ->willReturn(true); @@ -320,7 +325,12 @@ class StorageTest extends TestCase { ->will($this->returnCallback(array($this, 'getUidAndFilenameCallback'))); $this->util->expects($this->any()) ->method('isSystemWideMountPoint') - ->willReturn($systemWideMount); + ->willReturnCallback(function($path, $owner) use ($systemWideMountSource, $systemWideMountTarget) { + if(strpos($path, 'source.txt') !== false) { + return $systemWideMountSource; + } + return $systemWideMountTarget; + }); $this->storage->copyKeys($source, $target); } @@ -336,14 +346,20 @@ class StorageTest extends TestCase { public function dataProviderCopyRename() { return array( - array('/user1/files/foo.txt', '/user1/files/bar.txt', false, - '/user1/files_encryption/keys/files/foo.txt/', '/user1/files_encryption/keys/files/bar.txt/'), - array('/user1/files/foo/foo.txt', '/user1/files/bar.txt', false, - '/user1/files_encryption/keys/files/foo/foo.txt/', '/user1/files_encryption/keys/files/bar.txt/'), - array('/user1/files/foo.txt', '/user1/files/foo/bar.txt', false, - '/user1/files_encryption/keys/files/foo.txt/', '/user1/files_encryption/keys/files/foo/bar.txt/'), - array('/user1/files/foo.txt', '/user1/files/foo/bar.txt', true, - '/files_encryption/keys/files/foo.txt/', '/files_encryption/keys/files/foo/bar.txt/'), + array('/user1/files/source.txt', '/user1/files/target.txt', false, false, + '/user1/files_encryption/keys/files/source.txt/', '/user1/files_encryption/keys/files/target.txt/'), + array('/user1/files/foo/source.txt', '/user1/files/target.txt', false, false, + '/user1/files_encryption/keys/files/foo/source.txt/', '/user1/files_encryption/keys/files/target.txt/'), + array('/user1/files/source.txt', '/user1/files/foo/target.txt', false, false, + '/user1/files_encryption/keys/files/source.txt/', '/user1/files_encryption/keys/files/foo/target.txt/'), + array('/user1/files/source.txt', '/user1/files/foo/target.txt', true, true, + '/files_encryption/keys/files/source.txt/', '/files_encryption/keys/files/foo/target.txt/'), + array('/user1/files/source.txt', '/user1/files/target.txt', false, true, + '/user1/files_encryption/keys/files/source.txt/', '/files_encryption/keys/files/target.txt/'), + array('/user1/files/source.txt', '/user1/files/target.txt', true, false, + '/files_encryption/keys/files/source.txt/', '/user1/files_encryption/keys/files/target.txt/'), + + ); } |