diff options
author | Thomas Müller <thomas.mueller@tmit.eu> | 2015-10-14 12:38:16 +0200 |
---|---|---|
committer | Thomas Müller <thomas.mueller@tmit.eu> | 2015-10-14 12:38:16 +0200 |
commit | bfac6c5eb711442d87912e0706548774b2726751 (patch) | |
tree | 36c1c89de3200c1e153fd02c5de68151d78fde07 /tests/lib | |
parent | 01cc38018a81ae5ab72566b255d77b6d08ae6206 (diff) | |
parent | 06aaa059d177e42d6bf674a22588ccc98f91b3e1 (diff) | |
download | nextcloud-server-bfac6c5eb711442d87912e0706548774b2726751.tar.gz nextcloud-server-bfac6c5eb711442d87912e0706548774b2726751.zip |
Merge pull request #19730 from owncloud/fix_17560
Squash collection shares
Diffstat (limited to 'tests/lib')
-rw-r--r-- | tests/lib/share/share.php | 56 |
1 files changed, 56 insertions, 0 deletions
diff --git a/tests/lib/share/share.php b/tests/lib/share/share.php index 4cb0577cc8c..fc1357fe6e7 100644 --- a/tests/lib/share/share.php +++ b/tests/lib/share/share.php @@ -1679,6 +1679,62 @@ class Test_Share extends \Test\TestCase { $config->deleteAppValue('core', 'shareapi_default_expire_date'); $config->deleteAppValue('core', 'shareapi_expire_after_n_days'); } + + /** + * Test case for #17560 + */ + public function testAccesToSharedSubFolder() { + OC_User::setUserId($this->user1); + $view = new \OC\Files\View('/' . $this->user1 . '/'); + $view->mkdir('files/folder1'); + + $fileInfo = $view->getFileInfo('files/folder1'); + $this->assertInstanceOf('\OC\Files\FileInfo', $fileInfo); + $fileId = $fileInfo->getId(); + + $this->assertTrue( + OCP\Share::shareItem('folder', $fileId, OCP\Share::SHARE_TYPE_USER, $this->user2, \OCP\Constants::PERMISSION_ALL), + 'Failed asserting that user 1 successfully shared "test" with user 2.' + ); + $this->assertTrue( + OCP\Share::shareItem('folder', $fileId, OCP\Share::SHARE_TYPE_USER, $this->user3, \OCP\Constants::PERMISSION_ALL), + 'Failed asserting that user 1 successfully shared "test" with user 3.' + ); + + $view->mkdir('files/folder1/folder2'); + + $fileInfo = $view->getFileInfo('files/folder1/folder2'); + $this->assertInstanceOf('\OC\Files\FileInfo', $fileInfo); + $fileId = $fileInfo->getId(); + + $this->assertTrue( + OCP\Share::shareItem('folder', $fileId, OCP\Share::SHARE_TYPE_USER, $this->user4, \OCP\Constants::PERMISSION_ALL), + 'Failed asserting that user 1 successfully shared "test" with user 4.' + ); + + $res = OCP\Share::getItemShared( + 'folder', + $fileId, + OCP\Share::FORMAT_NONE, + null, + true + ); + $this->assertCount(3, $res); + + $this->assertTrue( + OCP\Share::shareItem('folder', $fileId, OCP\Share::SHARE_TYPE_USER, $this->user5, \OCP\Constants::PERMISSION_ALL), + 'Failed asserting that user 1 successfully shared "test" with user 5.' + ); + + $res = OCP\Share::getItemShared( + 'folder', + $fileId, + OCP\Share::FORMAT_NONE, + null, + true + ); + $this->assertCount(4, $res); + } } class DummyShareClass extends \OC\Share\Share { |