diff options
author | Vincent Petry <pvince81@owncloud.com> | 2015-06-26 17:32:05 +0300 |
---|---|---|
committer | Vincent Petry <pvince81@owncloud.com> | 2015-07-01 10:59:15 +0300 |
commit | 9eaa716667eae4f0752b66dcb2d7977eade6f94d (patch) | |
tree | cbf68ec67418d06f59c81f532b1121378c8033f4 /apps | |
parent | 40ab639013427c17cdf050b1e905d47afb74a566 (diff) |
Unit test for etag update on custom share folder
Diffstat (limited to 'apps')
-rw-r--r-- | apps/files_sharing/tests/updater.php | 44 |
1 files changed, 36 insertions, 8 deletions
diff --git a/apps/files_sharing/tests/updater.php b/apps/files_sharing/tests/updater.php index cdaff0d0a56..df2cbb41eed 100644 --- a/apps/files_sharing/tests/updater.php +++ b/apps/files_sharing/tests/updater.php @@ -115,14 +115,34 @@ class Test_Files_Sharing_Updater extends OCA\Files_sharing\Tests\TestCase { \OC\Files\Filesystem::getLoader()->removeStorageWrapper('oc_trashbin'); } + public function shareFolderProvider() { + return [ + ['/'], + ['/my_shares'], + ]; + } + /** * if a file gets shared the etag for the recipients root should change + * + * @dataProvider shareFolderProvider + * + * @param string $shareFolder share folder to use */ - function testShareFile() { + public function testShareFile($shareFolder) { + $config = \OC::$server->getConfig(); + $oldShareFolder = $config->getSystemValue('share_folder'); + $config->setSystemValue('share_folder', $shareFolder); + $this->loginHelper(self::TEST_FILES_SHARING_API_USER2); - $beforeShare = \OC\Files\Filesystem::getFileInfo(''); - $etagBeforeShare = $beforeShare->getEtag(); + $beforeShareRoot = \OC\Files\Filesystem::getFileInfo(''); + $etagBeforeShareRoot = $beforeShareRoot->getEtag(); + + \OC\Files\Filesystem::mkdir($shareFolder); + + $beforeShareDir = \OC\Files\Filesystem::getFileInfo($shareFolder); + $etagBeforeShareDir = $beforeShareDir->getEtag(); $this->loginHelper(self::TEST_FILES_SHARING_API_USER1); $fileinfo = \OC\Files\Filesystem::getFileInfo($this->folder); @@ -131,17 +151,25 @@ class Test_Files_Sharing_Updater extends OCA\Files_sharing\Tests\TestCase { $this->loginHelper(self::TEST_FILES_SHARING_API_USER2); - $afterShare = \OC\Files\Filesystem::getFileInfo(''); - $etagAfterShare = $afterShare->getEtag(); + $afterShareRoot = \OC\Files\Filesystem::getFileInfo(''); + $etagAfterShareRoot = $afterShareRoot->getEtag(); + + $afterShareDir = \OC\Files\Filesystem::getFileInfo($shareFolder); + $etagAfterShareDir = $afterShareDir->getEtag(); - $this->assertTrue(is_string($etagBeforeShare)); - $this->assertTrue(is_string($etagAfterShare)); - $this->assertTrue($etagBeforeShare !== $etagAfterShare); + $this->assertTrue(is_string($etagBeforeShareRoot)); + $this->assertTrue(is_string($etagBeforeShareDir)); + $this->assertTrue(is_string($etagAfterShareRoot)); + $this->assertTrue(is_string($etagAfterShareDir)); + $this->assertTrue($etagBeforeShareRoot !== $etagAfterShareRoot); + $this->assertTrue($etagBeforeShareDir !== $etagAfterShareDir); // 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); + + $config->setSystemValue('share_folder', $oldShareFolder); } /** |