[Pkg-owncloud-commits] [owncloud] 02/08: Unit test for etag update on custom share folder
David Prévot
taffit at moszumanska.debian.org
Wed Sep 2 13:07:02 UTC 2015
This is an automated email from the git hooks/post-receive script.
taffit pushed a commit to branch master
in repository owncloud.
commit f7e0370f32c3816bbeb5a198393d4c9324e51b84
Author: Vincent Petry <pvince81 at owncloud.com>
Date: Fri Jun 26 16:32:05 2015 +0200
Unit test for etag update on custom share folder
---
apps/files_sharing/tests/updater.php | 44 +++++++++++++++++++++++++++++-------
1 file changed, 36 insertions(+), 8 deletions(-)
diff --git a/apps/files_sharing/tests/updater.php b/apps/files_sharing/tests/updater.php
index 1f51b9a..81ba94c 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 Test_Files_Sharing_Base {
}
}
+ 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 Test_Files_Sharing_Base {
$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);
}
/**
--
Alioth's /usr/local/bin/git-commit-notice on /srv/git.debian.org/git/pkg-owncloud/owncloud.git
More information about the Pkg-owncloud-commits
mailing list