summaryrefslogtreecommitdiffstats
path: root/apps/files_sharing/tests
diff options
context:
space:
mode:
authorBjoern Schiessle <schiessle@owncloud.com>2014-07-02 15:35:15 +0200
committerBjoern Schiessle <schiessle@owncloud.com>2014-07-02 15:39:38 +0200
commitea31ab7b5c0f50075d15e69b6f2f1940fe2ac00f (patch)
tree0ecab420a1bcce1699a2a443e028a657251701ca /apps/files_sharing/tests
parent59629e688c3cc470279576524eac93041c253147 (diff)
downloadnextcloud-server-ea31ab7b5c0f50075d15e69b6f2f1940fe2ac00f.tar.gz
nextcloud-server-ea31ab7b5c0f50075d15e69b6f2f1940fe2ac00f.zip
rename mount point of children if parent was renamed
Diffstat (limited to 'apps/files_sharing/tests')
-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);
+ }
+
}