diff options
author | Robin Appelman <icewind@owncloud.com> | 2015-08-05 15:41:03 +0200 |
---|---|---|
committer | Robin Appelman <icewind@owncloud.com> | 2015-08-05 15:41:03 +0200 |
commit | 085acaf6ba2dcd0af7b2044859117c4229c41bbc (patch) | |
tree | 763b8af12097423572de6e015dfb3daef2c7de6d /apps | |
parent | a70f145d71808204193d3e1d63ad94bcf849b700 (diff) | |
download | nextcloud-server-085acaf6ba2dcd0af7b2044859117c4229c41bbc.tar.gz nextcloud-server-085acaf6ba2dcd0af7b2044859117c4229c41bbc.zip |
add unit tests for share target conflict with group shares
Diffstat (limited to 'apps')
-rw-r--r-- | apps/files_sharing/tests/sharedstorage.php | 39 |
1 files changed, 39 insertions, 0 deletions
diff --git a/apps/files_sharing/tests/sharedstorage.php b/apps/files_sharing/tests/sharedstorage.php index 7c28d0431e1..de510cf1eec 100644 --- a/apps/files_sharing/tests/sharedstorage.php +++ b/apps/files_sharing/tests/sharedstorage.php @@ -441,4 +441,43 @@ class Test_Files_Sharing_Storage extends OCA\Files_sharing\Tests\TestCase { self::loginHelper(self::TEST_FILES_SHARING_API_USER1); $this->view->unlink($this->folder); } + + public function testNameConflict() { + self::loginHelper(self::TEST_FILES_SHARING_API_USER1); + $view1 = new \OC\Files\View('/' . self::TEST_FILES_SHARING_API_USER1 . '/files'); + $view1->mkdir('foo'); + $folderInfo1 = $view1->getFileInfo('foo'); + + self::loginHelper(self::TEST_FILES_SHARING_API_USER3); + $view3 = new \OC\Files\View('/' . self::TEST_FILES_SHARING_API_USER3 . '/files'); + $view3->mkdir('foo'); + $folderInfo2 = $view3->getFileInfo('foo'); + + // share a folder with the same name from two different users to the same user + self::loginHelper(self::TEST_FILES_SHARING_API_USER1); + + \OCP\Share::shareItem('folder', $folderInfo1['fileid'], \OCP\Share::SHARE_TYPE_GROUP, + self::TEST_FILES_SHARING_API_GROUP1, 31); + + self::loginHelper(self::TEST_FILES_SHARING_API_USER2); + + self::loginHelper(self::TEST_FILES_SHARING_API_USER3); + + \OCP\Share::shareItem('folder', $folderInfo2['fileid'], \OCP\Share::SHARE_TYPE_GROUP, + self::TEST_FILES_SHARING_API_GROUP1, 31); + + self::loginHelper(self::TEST_FILES_SHARING_API_USER2); + $view2 = new \OC\Files\View('/' . self::TEST_FILES_SHARING_API_USER2 . '/files'); + + $this->assertTrue($view2->file_exists('/foo')); + $this->assertTrue($view2->file_exists('/foo (2)')); + + $mount = $view2->getMount('/foo'); + $this->assertInstanceOf('\OCA\Files_Sharing\SharedMount', $mount); + /** @var \OC\Files\Storage\Shared $storage */ + $storage = $mount->getStorage(); + + $source = $storage->getFile(''); + $this->assertEquals(self::TEST_FILES_SHARING_API_USER1, $source['uid_owner']); + } } |