summaryrefslogtreecommitdiffstats
path: root/apps/files_sharing/tests/updater.php
diff options
context:
space:
mode:
Diffstat (limited to 'apps/files_sharing/tests/updater.php')
-rw-r--r--apps/files_sharing/tests/updater.php36
1 files changed, 36 insertions, 0 deletions
diff --git a/apps/files_sharing/tests/updater.php b/apps/files_sharing/tests/updater.php
index cdb44068254..5ec53488702 100644
--- a/apps/files_sharing/tests/updater.php
+++ b/apps/files_sharing/tests/updater.php
@@ -217,4 +217,40 @@ class Test_Files_Sharing_Updater extends Test_Files_Sharing_Base {
}
+ /**
+ * if a folder gets renamed all children mount points should be renamed too
+ */
+ function testRename() {
+
+ $fileinfo = \OC\Files\Filesystem::getFileInfo($this->folder);
+ $result = \OCP\Share::shareItem('folder', $fileinfo->getId(), \OCP\Share::SHARE_TYPE_USER, self::TEST_FILES_SHARING_API_USER2, 31);
+ $this->assertTrue($result);
+
+ $this->loginHelper(self::TEST_FILES_SHARING_API_USER2);
+
+ // make sure that the shared folder exists
+ $this->assertTrue(\OC\Files\Filesystem::file_exists($this->folder));
+
+ \OC\Files\Filesystem::mkdir('oldTarget');
+ \OC\Files\Filesystem::mkdir('oldTarget/subfolder');
+ \OC\Files\Filesystem::mkdir('newTarget');
+
+ \OC\Files\Filesystem::rename($this->folder, 'oldTarget/subfolder/' . $this->folder);
+
+ // re-login to make sure that the new mount points are initialized
+ $this->loginHelper(self::TEST_FILES_SHARING_API_USER2);
+
+ \OC\Files\Filesystem::rename('/oldTarget', '/newTarget/oldTarget');
+
+ // re-login to make sure that the new mount points are initialized
+ $this->loginHelper(self::TEST_FILES_SHARING_API_USER2);
+
+ $this->assertTrue(\OC\Files\Filesystem::file_exists('/newTarget/oldTarget/subfolder/' . $this->folder));
+
+ // cleanup
+ $this->loginHelper(self::TEST_FILES_SHARING_API_USER1);
+ $result = \OCP\Share::unshare('folder', $fileinfo->getId(), \OCP\Share::SHARE_TYPE_USER, self::TEST_FILES_SHARING_API_USER2);
+ $this->assertTrue($result);
+ }
+
}