summaryrefslogtreecommitdiffstats
path: root/tests
diff options
context:
space:
mode:
authorMorris Jobke <hey@morrisjobke.de>2015-06-03 13:49:46 +0200
committerMorris Jobke <hey@morrisjobke.de>2015-06-03 13:49:46 +0200
commite3440863bc1108c0241498a0952379adc4a782b2 (patch)
tree5f26edf2d4f2df5d16f7568ee2379d4f7e4907ae /tests
parent9ba5081d47e23a92198336ef4366c72c5a996a3b (diff)
parent7eb2b31e34bf89a2c0fbf8c6d49aa1eed5899681 (diff)
downloadnextcloud-server-e3440863bc1108c0241498a0952379adc4a782b2.tar.gz
nextcloud-server-e3440863bc1108c0241498a0952379adc4a782b2.zip
Merge pull request #16708 from owncloud/enc_fix_move_to_trash
make sure that we always use the correct owner for both source and target
Diffstat (limited to 'tests')
-rw-r--r--tests/lib/encryption/keys/storage.php39
1 files changed, 39 insertions, 0 deletions
diff --git a/tests/lib/encryption/keys/storage.php b/tests/lib/encryption/keys/storage.php
index 52717bcdc29..4fec24094fd 100644
--- a/tests/lib/encryption/keys/storage.php
+++ b/tests/lib/encryption/keys/storage.php
@@ -361,7 +361,46 @@ class StorageTest extends TestCase {
array('/user1/files/source.txt', '/user1/files/target.txt', true, false,
'/files_encryption/keys/files/source.txt/', '/user1/files_encryption/keys/files/target.txt/'),
+ array('/user2/files/source.txt', '/user1/files/target.txt', false, false,
+ '/user2/files_encryption/keys/files/source.txt/', '/user1/files_encryption/keys/files/target.txt/'),
+ array('/user2/files/foo/source.txt', '/user1/files/target.txt', false, false,
+ '/user2/files_encryption/keys/files/foo/source.txt/', '/user1/files_encryption/keys/files/target.txt/'),
+ array('/user2/files/source.txt', '/user1/files/foo/target.txt', false, false,
+ '/user2/files_encryption/keys/files/source.txt/', '/user1/files_encryption/keys/files/foo/target.txt/'),
+ array('/user2/files/source.txt', '/user1/files/foo/target.txt', true, true,
+ '/files_encryption/keys/files/source.txt/', '/files_encryption/keys/files/foo/target.txt/'),
+ array('/user2/files/source.txt', '/user1/files/target.txt', false, true,
+ '/user2/files_encryption/keys/files/source.txt/', '/files_encryption/keys/files/target.txt/'),
+ array('/user2/files/source.txt', '/user1/files/target.txt', true, false,
+ '/files_encryption/keys/files/source.txt/', '/user1/files_encryption/keys/files/target.txt/'),
+ );
+ }
+ /**
+ * @dataProvider dataTestGetPathToKeys
+ *
+ * @param string $path
+ * @param boolean $systemWideMountPoint
+ * @param string $expected
+ */
+ public function testGetPathToKeys($path, $systemWideMountPoint, $expected) {
+
+ $this->util->expects($this->any())
+ ->method('getUidAndFilename')
+ ->will($this->returnCallback(array($this, 'getUidAndFilenameCallback')));
+ $this->util->expects($this->any())
+ ->method('isSystemWideMountPoint')
+ ->willReturn($systemWideMountPoint);
+
+ $this->assertSame($expected,
+ \Test_Helper::invokePrivate($this->storage, 'getPathToKeys', [$path])
+ );
+ }
+
+ public function dataTestGetPathToKeys() {
+ return array(
+ array('/user1/files/source.txt', false, '/user1/files_encryption/keys/files/source.txt/'),
+ array('/user1/files/source.txt', true, '/files_encryption/keys/files/source.txt/')
);
}