diff options
author | Joas Schilling <coding@schilljs.com> | 2020-06-24 16:49:16 +0200 |
---|---|---|
committer | Joas Schilling <coding@schilljs.com> | 2020-06-24 16:49:16 +0200 |
commit | 89ed2c37bf656ceb772bb6759c8977a7dc78b3fb (patch) | |
tree | 4a467f829fcc748531cad54e7c08e06dd98d1b7d /apps/files_sharing/tests | |
parent | 654cd18864c943d9ff93c2e6151bb6529fa44513 (diff) | |
download | nextcloud-server-89ed2c37bf656ceb772bb6759c8977a7dc78b3fb.tar.gz nextcloud-server-89ed2c37bf656ceb772bb6759c8977a7dc78b3fb.zip |
Update share type constant usage
Signed-off-by: Joas Schilling <coding@schilljs.com>
Diffstat (limited to 'apps/files_sharing/tests')
20 files changed, 267 insertions, 254 deletions
diff --git a/apps/files_sharing/tests/ApiTest.php b/apps/files_sharing/tests/ApiTest.php index 9e7d8e5c693..5339128fbef 100644 --- a/apps/files_sharing/tests/ApiTest.php +++ b/apps/files_sharing/tests/ApiTest.php @@ -134,7 +134,7 @@ class ApiTest extends TestCase { public function testCreateShareUserFile() { $this->setUp(); // for some reasons phpunit refuses to do this for us only for this test $ocs = $this->createOCS(self::TEST_FILES_SHARING_API_USER1); - $result = $ocs->createShare($this->filename, \OCP\Constants::PERMISSION_ALL, \OCP\Share::SHARE_TYPE_USER, self::TEST_FILES_SHARING_API_USER2); + $result = $ocs->createShare($this->filename, \OCP\Constants::PERMISSION_ALL, IShare::TYPE_USER, self::TEST_FILES_SHARING_API_USER2); $ocs->cleanup(); $data = $result->getData(); @@ -151,7 +151,7 @@ class ApiTest extends TestCase { public function testCreateShareUserFolder() { $ocs = $this->createOCS(self::TEST_FILES_SHARING_API_USER1); - $result = $ocs->createShare($this->folder, \OCP\Constants::PERMISSION_ALL, \OCP\Share::SHARE_TYPE_USER, self::TEST_FILES_SHARING_API_USER2); + $result = $ocs->createShare($this->folder, \OCP\Constants::PERMISSION_ALL, IShare::TYPE_USER, self::TEST_FILES_SHARING_API_USER2); $ocs->cleanup(); $data = $result->getData(); @@ -168,7 +168,7 @@ class ApiTest extends TestCase { public function testCreateShareGroupFile() { $ocs = $this->createOCS(self::TEST_FILES_SHARING_API_USER1); - $result = $ocs->createShare($this->filename, \OCP\Constants::PERMISSION_ALL, \OCP\Share::SHARE_TYPE_GROUP, self::TEST_FILES_SHARING_API_GROUP1); + $result = $ocs->createShare($this->filename, \OCP\Constants::PERMISSION_ALL, IShare::TYPE_GROUP, self::TEST_FILES_SHARING_API_GROUP1); $ocs->cleanup(); $data = $result->getData(); @@ -184,7 +184,7 @@ class ApiTest extends TestCase { public function testCreateShareGroupFolder() { $ocs = $this->createOCS(self::TEST_FILES_SHARING_API_USER1); - $result = $ocs->createShare($this->folder, \OCP\Constants::PERMISSION_ALL, \OCP\Share::SHARE_TYPE_GROUP, self::TEST_FILES_SHARING_API_GROUP1); + $result = $ocs->createShare($this->folder, \OCP\Constants::PERMISSION_ALL, IShare::TYPE_GROUP, self::TEST_FILES_SHARING_API_GROUP1); $ocs->cleanup(); $data = $result->getData(); @@ -200,7 +200,7 @@ class ApiTest extends TestCase { public function testCreateShareLink() { $ocs = $this->createOCS(self::TEST_FILES_SHARING_API_USER1); - $result = $ocs->createShare($this->folder, \OCP\Constants::PERMISSION_ALL, \OCP\Share::SHARE_TYPE_LINK); + $result = $ocs->createShare($this->folder, \OCP\Constants::PERMISSION_ALL, IShare::TYPE_LINK); $ocs->cleanup(); $data = $result->getData(); @@ -223,7 +223,7 @@ class ApiTest extends TestCase { public function testCreateShareLinkPublicUpload() { $ocs = $this->createOCS(self::TEST_FILES_SHARING_API_USER1); - $result = $ocs->createShare($this->folder, \OCP\Constants::PERMISSION_ALL, \OCP\Share::SHARE_TYPE_LINK, null, 'true'); + $result = $ocs->createShare($this->folder, \OCP\Constants::PERMISSION_ALL, IShare::TYPE_LINK, null, 'true'); $ocs->cleanup(); $data = $result->getData(); @@ -256,7 +256,7 @@ class ApiTest extends TestCase { $ocs = $this->createOCS(self::TEST_FILES_SHARING_API_USER1); try { - $ocs->createShare($this->folder, \OCP\Constants::PERMISSION_ALL, \OCP\Share::SHARE_TYPE_LINK); + $ocs->createShare($this->folder, \OCP\Constants::PERMISSION_ALL, IShare::TYPE_LINK); $this->fail(); } catch (OCSForbiddenException $e) { } @@ -264,7 +264,7 @@ class ApiTest extends TestCase { $ocs = $this->createOCS(self::TEST_FILES_SHARING_API_USER1); try { - $ocs->createShare($this->folder, \OCP\Constants::PERMISSION_ALL, \OCP\Share::SHARE_TYPE_LINK, null, 'false', ''); + $ocs->createShare($this->folder, \OCP\Constants::PERMISSION_ALL, IShare::TYPE_LINK, null, 'false', ''); $this->fail(); } catch (OCSForbiddenException $e) { } @@ -272,7 +272,7 @@ class ApiTest extends TestCase { // share with password should succeed $ocs = $this->createOCS(self::TEST_FILES_SHARING_API_USER1); - $result = $ocs->createShare($this->folder, \OCP\Constants::PERMISSION_ALL, \OCP\Share::SHARE_TYPE_LINK, null, 'false', $password); + $result = $ocs->createShare($this->folder, \OCP\Constants::PERMISSION_ALL, IShare::TYPE_LINK, null, 'false', $password); $ocs->cleanup(); $data = $result->getData(); @@ -309,7 +309,7 @@ class ApiTest extends TestCase { \OC::$server->getConfig()->setAppValue('core', 'shareapi_exclude_groups', 'no'); $ocs = $this->createOCS(self::TEST_FILES_SHARING_API_USER1); - $result = $ocs->createShare($this->filename, \OCP\Constants::PERMISSION_ALL, \OCP\Share::SHARE_TYPE_USER, self::TEST_FILES_SHARING_API_USER2); + $result = $ocs->createShare($this->filename, \OCP\Constants::PERMISSION_ALL, IShare::TYPE_USER, self::TEST_FILES_SHARING_API_USER2); $ocs->cleanup(); $data = $result->getData(); @@ -325,7 +325,7 @@ class ApiTest extends TestCase { \OC::$server->getConfig()->setAppValue('core', 'shareapi_exclude_groups_list', 'admin,group1,group2'); $ocs = $this->createOCS(self::TEST_FILES_SHARING_API_USER1); - $result = $ocs->createShare($this->filename, \OCP\Constants::PERMISSION_ALL, \OCP\Share::SHARE_TYPE_USER, self::TEST_FILES_SHARING_API_USER2); + $result = $ocs->createShare($this->filename, \OCP\Constants::PERMISSION_ALL, IShare::TYPE_USER, self::TEST_FILES_SHARING_API_USER2); $ocs->cleanup(); $data = $result->getData(); @@ -340,7 +340,7 @@ class ApiTest extends TestCase { \OC::$server->getConfig()->setAppValue('core', 'shareapi_exclude_groups_list', 'admin,group'); $ocs = $this->createOCS(self::TEST_FILES_SHARING_API_USER1); - $ocs->createShare($this->filename, \OCP\Constants::PERMISSION_ALL, \OCP\Share::SHARE_TYPE_USER, self::TEST_FILES_SHARING_API_USER2); + $ocs->createShare($this->filename, \OCP\Constants::PERMISSION_ALL, IShare::TYPE_USER, self::TEST_FILES_SHARING_API_USER2); $ocs->cleanup(); // cleanup @@ -361,7 +361,7 @@ class ApiTest extends TestCase { $share->setNode($node) ->setSharedBy(self::TEST_FILES_SHARING_API_USER1) ->setSharedWith(self::TEST_FILES_SHARING_API_USER2) - ->setShareType(\OCP\Share::SHARE_TYPE_USER) + ->setShareType(IShare::TYPE_USER) ->setPermissions(19); $share = $this->shareManager->createShare($share); @@ -381,7 +381,7 @@ class ApiTest extends TestCase { $share1->setNode($node1) ->setSharedBy(self::TEST_FILES_SHARING_API_USER1) ->setSharedWith(self::TEST_FILES_SHARING_API_USER2) - ->setShareType(\OCP\Share::SHARE_TYPE_USER) + ->setShareType(IShare::TYPE_USER) ->setPermissions(19); $share1 = $this->shareManager->createShare($share1); $share1->setStatus(IShare::STATUS_ACCEPTED); @@ -392,7 +392,7 @@ class ApiTest extends TestCase { $share2->setNode($node2) ->setSharedBy(self::TEST_FILES_SHARING_API_USER1) ->setSharedWith(self::TEST_FILES_SHARING_API_USER2) - ->setShareType(\OCP\Share::SHARE_TYPE_USER) + ->setShareType(IShare::TYPE_USER) ->setPermissions(31); $share2 = $this->shareManager->createShare($share2); $share2->setStatus(IShare::STATUS_ACCEPTED); @@ -413,7 +413,7 @@ class ApiTest extends TestCase { */ public function testPublicLinkUrl() { $ocs = $this->createOCS(self::TEST_FILES_SHARING_API_USER1); - $result = $ocs->createShare($this->folder, \OCP\Constants::PERMISSION_ALL, \OCP\Share::SHARE_TYPE_LINK); + $result = $ocs->createShare($this->folder, \OCP\Constants::PERMISSION_ALL, IShare::TYPE_LINK); $ocs->cleanup(); $data = $result->getData(); @@ -466,14 +466,14 @@ class ApiTest extends TestCase { $share->setNode($node) ->setSharedBy(self::TEST_FILES_SHARING_API_USER1) ->setSharedWith(self::TEST_FILES_SHARING_API_USER2) - ->setShareType(\OCP\Share::SHARE_TYPE_USER) + ->setShareType(IShare::TYPE_USER) ->setPermissions(19); $share1 = $this->shareManager->createShare($share); $share = $this->shareManager->newShare(); $share->setNode($node) ->setSharedBy(self::TEST_FILES_SHARING_API_USER1) - ->setShareType(\OCP\Share::SHARE_TYPE_LINK) + ->setShareType(IShare::TYPE_LINK) ->setPermissions(1); $share2 = $this->shareManager->createShare($share); @@ -499,7 +499,7 @@ class ApiTest extends TestCase { $share1->setNode($node) ->setSharedBy(self::TEST_FILES_SHARING_API_USER1) ->setSharedWith(self::TEST_FILES_SHARING_API_USER2) - ->setShareType(\OCP\Share::SHARE_TYPE_USER) + ->setShareType(IShare::TYPE_USER) ->setPermissions(19); $share1 = $this->shareManager->createShare($share1); @@ -507,7 +507,7 @@ class ApiTest extends TestCase { $share2->setNode($node) ->setSharedBy(self::TEST_FILES_SHARING_API_USER2) ->setSharedWith(self::TEST_FILES_SHARING_API_USER3) - ->setShareType(\OCP\Share::SHARE_TYPE_USER) + ->setShareType(IShare::TYPE_USER) ->setPermissions(19); $share2 = $this->shareManager->createShare($share2); @@ -540,7 +540,7 @@ class ApiTest extends TestCase { $share1->setNode($node) ->setSharedBy(self::TEST_FILES_SHARING_API_USER1) ->setSharedWith(self::TEST_FILES_SHARING_API_USER2) - ->setShareType(\OCP\Share::SHARE_TYPE_USER) + ->setShareType(IShare::TYPE_USER) ->setPermissions(19); $share1 = $this->shareManager->createShare($share1); @@ -564,7 +564,7 @@ class ApiTest extends TestCase { $share1->setNode($node1) ->setSharedBy(self::TEST_FILES_SHARING_API_USER1) ->setSharedWith(self::TEST_FILES_SHARING_API_USER2) - ->setShareType(\OCP\Share::SHARE_TYPE_USER) + ->setShareType(IShare::TYPE_USER) ->setPermissions(19); $share1 = $this->shareManager->createShare($share1); @@ -572,7 +572,7 @@ class ApiTest extends TestCase { $share2 = $this->shareManager->newShare(); $share2->setNode($node2) ->setSharedBy(self::TEST_FILES_SHARING_API_USER1) - ->setShareType(\OCP\Share::SHARE_TYPE_LINK) + ->setShareType(IShare::TYPE_LINK) ->setPermissions(1); $share2 = $this->shareManager->createShare($share2); @@ -594,7 +594,7 @@ class ApiTest extends TestCase { $share1->setNode($node1) ->setSharedBy(self::TEST_FILES_SHARING_API_USER1) ->setSharedWith(self::TEST_FILES_SHARING_API_USER2) - ->setShareType(\OCP\Share::SHARE_TYPE_USER) + ->setShareType(IShare::TYPE_USER) ->setPermissions(19); $share1 = $this->shareManager->createShare($share1); @@ -620,7 +620,7 @@ class ApiTest extends TestCase { $share1->setNode($node1) ->setSharedBy(self::TEST_FILES_SHARING_API_USER1) ->setSharedWith(self::TEST_FILES_SHARING_API_USER2) - ->setShareType(\OCP\Share::SHARE_TYPE_USER) + ->setShareType(IShare::TYPE_USER) ->setPermissions(31); $share1 = $this->shareManager->createShare($share1); $share1->setStatus(IShare::STATUS_ACCEPTED); @@ -630,7 +630,7 @@ class ApiTest extends TestCase { $share2 = $this->shareManager->newShare(); $share2->setNode($node2) ->setSharedBy(self::TEST_FILES_SHARING_API_USER2) - ->setShareType(\OCP\Share::SHARE_TYPE_LINK) + ->setShareType(IShare::TYPE_LINK) ->setPermissions(1); $share2 = $this->shareManager->createShare($share2); $share2->setStatus(IShare::STATUS_ACCEPTED); @@ -640,7 +640,7 @@ class ApiTest extends TestCase { $share3 = $this->shareManager->newShare(); $share3->setNode($node3) ->setSharedBy(self::TEST_FILES_SHARING_API_USER2) - ->setShareType(\OCP\Share::SHARE_TYPE_LINK) + ->setShareType(IShare::TYPE_LINK) ->setPermissions(1); $share3 = $this->shareManager->createShare($share3); $share3->setStatus(IShare::STATUS_ACCEPTED); @@ -680,7 +680,7 @@ class ApiTest extends TestCase { $share1->setNode($node1) ->setSharedBy(self::TEST_FILES_SHARING_API_USER1) ->setSharedWith(self::TEST_FILES_SHARING_API_USER2) - ->setShareType(\OCP\Share::SHARE_TYPE_USER) + ->setShareType(IShare::TYPE_USER) ->setPermissions(31); $share1 = $this->shareManager->createShare($share1); $share1->setStatus(IShare::STATUS_ACCEPTED); @@ -690,7 +690,7 @@ class ApiTest extends TestCase { $share2 = $this->shareManager->newShare(); $share2->setNode($node2) ->setSharedBy(self::TEST_FILES_SHARING_API_USER2) - ->setShareType(\OCP\Share::SHARE_TYPE_LINK) + ->setShareType(IShare::TYPE_LINK) ->setPermissions(1); $share2 = $this->shareManager->createShare($share2); $share2->setStatus(IShare::STATUS_ACCEPTED); @@ -722,7 +722,7 @@ class ApiTest extends TestCase { $share1->setNode($node1) ->setSharedBy(self::TEST_FILES_SHARING_API_USER1) ->setSharedWith(self::TEST_FILES_SHARING_API_USER2) - ->setShareType(\OCP\Share::SHARE_TYPE_USER) + ->setShareType(IShare::TYPE_USER) ->setPermissions(31); $share1 = $this->shareManager->createShare($share1); @@ -731,14 +731,14 @@ class ApiTest extends TestCase { $share2->setNode($node2) ->setSharedBy(self::TEST_FILES_SHARING_API_USER2) ->setSharedWith(self::TEST_FILES_SHARING_API_USER3) - ->setShareType(\OCP\Share::SHARE_TYPE_USER) + ->setShareType(IShare::TYPE_USER) ->setPermissions(31); $share2 = $this->shareManager->createShare($share2); $share3 = $this->shareManager->newShare(); $share3->setNode($node2) ->setSharedBy(self::TEST_FILES_SHARING_API_USER3) - ->setShareType(\OCP\Share::SHARE_TYPE_LINK) + ->setShareType(IShare::TYPE_LINK) ->setPermissions(1); $share3 = $this->shareManager->createShare($share3); @@ -800,7 +800,7 @@ class ApiTest extends TestCase { $share1->setNode($node1) ->setSharedBy(self::TEST_FILES_SHARING_API_USER1) ->setSharedWith(self::TEST_FILES_SHARING_API_USER2) - ->setShareType(\OCP\Share::SHARE_TYPE_USER) + ->setShareType(IShare::TYPE_USER) ->setPermissions(31); $share1 = $this->shareManager->createShare($share1); $share1->setStatus(IShare::STATUS_ACCEPTED); @@ -811,7 +811,7 @@ class ApiTest extends TestCase { $share2->setNode($node2) ->setSharedBy(self::TEST_FILES_SHARING_API_USER1) ->setSharedWith(self::TEST_FILES_SHARING_API_USER2) - ->setShareType(\OCP\Share::SHARE_TYPE_USER) + ->setShareType(IShare::TYPE_USER) ->setPermissions(31); $share2 = $this->shareManager->createShare($share2); $share2->setStatus(IShare::STATUS_ACCEPTED); @@ -820,7 +820,7 @@ class ApiTest extends TestCase { $share3 = $this->shareManager->newShare(); $share3->setNode($node1) ->setSharedBy(self::TEST_FILES_SHARING_API_USER2) - ->setShareType(\OCP\Share::SHARE_TYPE_LINK) + ->setShareType(IShare::TYPE_LINK) ->setPermissions(1); $share3 = $this->shareManager->createShare($share3); $share3->setStatus(IShare::STATUS_ACCEPTED); @@ -864,7 +864,7 @@ class ApiTest extends TestCase { $share1->setNode($node1) ->setSharedBy(self::TEST_FILES_SHARING_API_USER1) ->setSharedWith(self::TEST_FILES_SHARING_API_USER2) - ->setShareType(\OCP\Share::SHARE_TYPE_USER) + ->setShareType(IShare::TYPE_USER) ->setPermissions(31); $share1 = $this->shareManager->createShare($share1); $share1->setStatus(IShare::STATUS_ACCEPTED); @@ -876,7 +876,7 @@ class ApiTest extends TestCase { $share2->setNode($node2) ->setSharedBy(self::TEST_FILES_SHARING_API_USER2) ->setSharedWith(self::TEST_FILES_SHARING_API_USER3) - ->setShareType(\OCP\Share::SHARE_TYPE_USER) + ->setShareType(IShare::TYPE_USER) ->setPermissions(19); $share2 = $this->shareManager->createShare($share2); $share2->setStatus(IShare::STATUS_ACCEPTED); @@ -887,7 +887,7 @@ class ApiTest extends TestCase { $share3 = $this->shareManager->newShare(); $share3->setNode($node3) ->setSharedBy(self::TEST_FILES_SHARING_API_USER3) - ->setShareType(\OCP\Share::SHARE_TYPE_LINK) + ->setShareType(IShare::TYPE_LINK) ->setPermissions(1); $share3 = $this->shareManager->createShare($share3); $share3->setStatus(IShare::STATUS_ACCEPTED); @@ -937,14 +937,14 @@ class ApiTest extends TestCase { $share1->setNode($node1) ->setSharedBy(self::TEST_FILES_SHARING_API_USER1) ->setSharedWith(self::TEST_FILES_SHARING_API_USER2) - ->setShareType(\OCP\Share::SHARE_TYPE_USER) + ->setShareType(IShare::TYPE_USER) ->setPermissions(19); $share1 = $this->shareManager->createShare($share1); $share2 = $this->shareManager->newShare(); $share2->setNode($node1) ->setSharedBy(self::TEST_FILES_SHARING_API_USER1) - ->setShareType(\OCP\Share::SHARE_TYPE_LINK) + ->setShareType(IShare::TYPE_LINK) ->setPermissions(1); $share2 = $this->shareManager->createShare($share2); @@ -985,7 +985,7 @@ class ApiTest extends TestCase { $share1 = $this->shareManager->newShare(); $share1->setNode($node1) ->setSharedBy(self::TEST_FILES_SHARING_API_USER1) - ->setShareType(\OCP\Share::SHARE_TYPE_LINK) + ->setShareType(IShare::TYPE_LINK) ->setPermissions(1); $share1 = $this->shareManager->createShare($share1); @@ -1016,7 +1016,7 @@ class ApiTest extends TestCase { $share1 = $this->shareManager->newShare(); $share1->setNode($node1) ->setSharedBy(self::TEST_FILES_SHARING_API_USER1) - ->setShareType(\OCP\Share::SHARE_TYPE_LINK) + ->setShareType(IShare::TYPE_LINK) ->setPermissions(1); $share1 = $this->shareManager->createShare($share1); $share1->setStatus(IShare::STATUS_ACCEPTED); @@ -1089,14 +1089,14 @@ class ApiTest extends TestCase { $share1->setNode($node1) ->setSharedBy(self::TEST_FILES_SHARING_API_USER1) ->setSharedWith(self::TEST_FILES_SHARING_API_USER2) - ->setShareType(\OCP\Share::SHARE_TYPE_USER) + ->setShareType(IShare::TYPE_USER) ->setPermissions(19); $share1 = $this->shareManager->createShare($share1); $share2 = $this->shareManager->newShare(); $share2->setNode($node1) ->setSharedBy(self::TEST_FILES_SHARING_API_USER1) - ->setShareType(\OCP\Share::SHARE_TYPE_LINK) + ->setShareType(IShare::TYPE_LINK) ->setPermissions(1); $share2 = $this->shareManager->createShare($share1); @@ -1108,8 +1108,8 @@ class ApiTest extends TestCase { $ocs->deleteShare($share2->getId()); $ocs->cleanup(); - $this->assertEmpty($this->shareManager->getSharesBy(self::TEST_FILES_SHARING_API_USER2, \OCP\Share::SHARE_TYPE_USER)); - $this->assertEmpty($this->shareManager->getSharesBy(self::TEST_FILES_SHARING_API_USER2, \OCP\Share::SHARE_TYPE_LINK)); + $this->assertEmpty($this->shareManager->getSharesBy(self::TEST_FILES_SHARING_API_USER2, IShare::TYPE_USER)); + $this->assertEmpty($this->shareManager->getSharesBy(self::TEST_FILES_SHARING_API_USER2, IShare::TYPE_LINK)); } /** @@ -1121,7 +1121,7 @@ class ApiTest extends TestCase { $share1->setNode($node1) ->setSharedBy(self::TEST_FILES_SHARING_API_USER1) ->setSharedWith(self::TEST_FILES_SHARING_API_USER2) - ->setShareType(\OCP\Share::SHARE_TYPE_USER) + ->setShareType(IShare::TYPE_USER) ->setPermissions(31); $share1 = $this->shareManager->createShare($share1); $share1->setStatus(IShare::STATUS_ACCEPTED); @@ -1132,7 +1132,7 @@ class ApiTest extends TestCase { $share2 = $this->shareManager->newShare(); $share2->setNode($node2) ->setSharedBy(self::TEST_FILES_SHARING_API_USER2) - ->setShareType(\OCP\Share::SHARE_TYPE_LINK) + ->setShareType(IShare::TYPE_LINK) ->setPermissions(1); $share2 = $this->shareManager->createShare($share2); $share2->setStatus(IShare::STATUS_ACCEPTED); @@ -1155,7 +1155,7 @@ class ApiTest extends TestCase { self::loginHelper(self::TEST_FILES_SHARING_API_USER1); $share = $this->share( - \OCP\Share::SHARE_TYPE_USER, + IShare::TYPE_USER, $this->folder, self::TEST_FILES_SHARING_API_USER1, self::TEST_FILES_SHARING_API_USER2, @@ -1182,7 +1182,7 @@ class ApiTest extends TestCase { $pass = true; try { $this->share( - \OCP\Share::SHARE_TYPE_USER, + IShare::TYPE_USER, 'localDir', self::TEST_FILES_SHARING_API_USER2, self::TEST_FILES_SHARING_API_USER3, @@ -1229,7 +1229,7 @@ class ApiTest extends TestCase { // user 1 shares the mount point folder with user2 $share = $this->share( - \OCP\Share::SHARE_TYPE_USER, + IShare::TYPE_USER, $this->folder, self::TEST_FILES_SHARING_API_USER1, self::TEST_FILES_SHARING_API_USER2, @@ -1274,7 +1274,7 @@ class ApiTest extends TestCase { $ocs = $this->createOCS(self::TEST_FILES_SHARING_API_USER1); try { - $result = $ocs->createShare($this->folder, \OCP\Constants::PERMISSION_ALL, \OCP\Share::SHARE_TYPE_LINK, null, 'false', '', null, $date); + $result = $ocs->createShare($this->folder, \OCP\Constants::PERMISSION_ALL, IShare::TYPE_LINK, null, 'false', '', null, $date); $this->assertTrue($valid); } catch (OCSNotFoundException $e) { $this->assertFalse($valid); @@ -1310,7 +1310,7 @@ class ApiTest extends TestCase { $date->add(new \DateInterval('P5D')); $ocs = $this->createOCS(self::TEST_FILES_SHARING_API_USER1); - $result = $ocs->createShare($this->filename, \OCP\Constants::PERMISSION_ALL, \OCP\Share::SHARE_TYPE_LINK, null, 'false', '', null, $date->format('Y-m-d')); + $result = $ocs->createShare($this->filename, \OCP\Constants::PERMISSION_ALL, IShare::TYPE_LINK, null, 'false', '', null, $date->format('Y-m-d')); $ocs->cleanup(); $data = $result->getData(); @@ -1344,7 +1344,7 @@ class ApiTest extends TestCase { $ocs = $this->createOCS(self::TEST_FILES_SHARING_API_USER1); try { - $ocs->createShare($this->filename, \OCP\Constants::PERMISSION_ALL, \OCP\Share::SHARE_TYPE_LINK, null, 'false', '', null, $date->format('Y-m-d')); + $ocs->createShare($this->filename, \OCP\Constants::PERMISSION_ALL, IShare::TYPE_LINK, null, 'false', '', null, $date->format('Y-m-d')); $this->fail(); } catch (OCSException $e) { $this->assertEquals(404, $e->getCode()); @@ -1365,7 +1365,7 @@ class ApiTest extends TestCase { $ocs = $this->createOCS(self::TEST_FILES_SHARING_API_USER1); try { - $ocs->createShare($this->filename, \OCP\Constants::PERMISSION_ALL, \OCP\Share::SHARE_TYPE_LINK, null, 'false', '', null, $date->format('Y-m-d')); + $ocs->createShare($this->filename, \OCP\Constants::PERMISSION_ALL, IShare::TYPE_LINK, null, 'false', '', null, $date->format('Y-m-d')); $this->fail(); } catch (OCSException $e) { $this->assertEquals(404, $e->getCode()); @@ -1384,7 +1384,7 @@ class ApiTest extends TestCase { public function testInvisibleSharesUser() { // simulate a post request $ocs = $this->createOCS(self::TEST_FILES_SHARING_API_USER1); - $result = $ocs->createShare($this->folder, \OCP\Constants::PERMISSION_ALL, \OCP\Share::SHARE_TYPE_USER, self::TEST_FILES_SHARING_API_USER2); + $result = $ocs->createShare($this->folder, \OCP\Constants::PERMISSION_ALL, IShare::TYPE_USER, self::TEST_FILES_SHARING_API_USER2); $ocs->cleanup(); $data = $result->getData(); @@ -1395,7 +1395,7 @@ class ApiTest extends TestCase { $ocs->cleanup(); $ocs = $this->createOCS(self::TEST_FILES_SHARING_API_USER2); - $ocs->createShare($this->folder, \OCP\Constants::PERMISSION_ALL, \OCP\Share::SHARE_TYPE_LINK); + $ocs->createShare($this->folder, \OCP\Constants::PERMISSION_ALL, IShare::TYPE_LINK); $ocs->cleanup(); $ocs = $this->createOCS(self::TEST_FILES_SHARING_API_USER1); @@ -1416,7 +1416,7 @@ class ApiTest extends TestCase { public function testInvisibleSharesGroup() { // simulate a post request $ocs = $this->createOCS(self::TEST_FILES_SHARING_API_USER1); - $result = $ocs->createShare($this->folder, \OCP\Constants::PERMISSION_ALL, \OCP\Share::SHARE_TYPE_GROUP, self::TEST_FILES_SHARING_API_GROUP1); + $result = $ocs->createShare($this->folder, \OCP\Constants::PERMISSION_ALL, IShare::TYPE_GROUP, self::TEST_FILES_SHARING_API_GROUP1); $ocs->cleanup(); $data = $result->getData(); @@ -1429,7 +1429,7 @@ class ApiTest extends TestCase { \OC_Util::tearDownFS(); $ocs = $this->createOCS(self::TEST_FILES_SHARING_API_USER2); - $ocs->createShare($this->folder, \OCP\Constants::PERMISSION_ALL, \OCP\Share::SHARE_TYPE_LINK); + $ocs->createShare($this->folder, \OCP\Constants::PERMISSION_ALL, IShare::TYPE_LINK); $ocs->cleanup(); $ocs = $this->createOCS(self::TEST_FILES_SHARING_API_USER1); diff --git a/apps/files_sharing/tests/CacheTest.php b/apps/files_sharing/tests/CacheTest.php index 09fc9f6f5a7..7b80bfcaaae 100644 --- a/apps/files_sharing/tests/CacheTest.php +++ b/apps/files_sharing/tests/CacheTest.php @@ -100,7 +100,7 @@ class CacheTest extends TestCase { $node = $rootFolder->get('container/shareddir'); $share = $this->shareManager->newShare(); $share->setNode($node) - ->setShareType(\OCP\Share::SHARE_TYPE_USER) + ->setShareType(IShare::TYPE_USER) ->setSharedWith(self::TEST_FILES_SHARING_API_USER2) ->setSharedBy(self::TEST_FILES_SHARING_API_USER1) ->setPermissions(\OCP\Constants::PERMISSION_ALL); @@ -111,7 +111,7 @@ class CacheTest extends TestCase { $node = $rootFolder->get('container/shared single file.txt'); $share = $this->shareManager->newShare(); $share->setNode($node) - ->setShareType(\OCP\Share::SHARE_TYPE_USER) + ->setShareType(IShare::TYPE_USER) ->setSharedWith(self::TEST_FILES_SHARING_API_USER2) ->setSharedBy(self::TEST_FILES_SHARING_API_USER1) ->setPermissions(\OCP\Constants::PERMISSION_ALL & ~(\OCP\Constants::PERMISSION_CREATE | \OCP\Constants::PERMISSION_DELETE)); @@ -135,7 +135,7 @@ class CacheTest extends TestCase { self::loginHelper(self::TEST_FILES_SHARING_API_USER1); - $shares = $this->shareManager->getSharesBy(self::TEST_FILES_SHARING_API_USER1, \OCP\Share::SHARE_TYPE_USER); + $shares = $this->shareManager->getSharesBy(self::TEST_FILES_SHARING_API_USER1, IShare::TYPE_USER); foreach ($shares as $share) { $this->shareManager->deleteShare($share); } @@ -312,7 +312,7 @@ class CacheTest extends TestCase { $node = $rootFolder->get('container/shareddir/subdir'); $share = $this->shareManager->newShare(); $share->setNode($node) - ->setShareType(\OCP\Share::SHARE_TYPE_USER) + ->setShareType(IShare::TYPE_USER) ->setSharedWith(self::TEST_FILES_SHARING_API_USER3) ->setSharedBy(self::TEST_FILES_SHARING_API_USER1) ->setPermissions(\OCP\Constants::PERMISSION_ALL); @@ -398,7 +398,7 @@ class CacheTest extends TestCase { $node = $rootFolder->get('test.txt'); $share = $this->shareManager->newShare(); $share->setNode($node) - ->setShareType(\OCP\Share::SHARE_TYPE_USER) + ->setShareType(IShare::TYPE_USER) ->setSharedWith(self::TEST_FILES_SHARING_API_USER2) ->setSharedBy(self::TEST_FILES_SHARING_API_USER1) ->setPermissions(\OCP\Constants::PERMISSION_READ | \OCP\Constants::PERMISSION_UPDATE | \OCP\Constants::PERMISSION_SHARE); @@ -431,7 +431,7 @@ class CacheTest extends TestCase { $node = $rootFolder->get('foo'); $share = $this->shareManager->newShare(); $share->setNode($node) - ->setShareType(\OCP\Share::SHARE_TYPE_USER) + ->setShareType(IShare::TYPE_USER) ->setSharedWith(self::TEST_FILES_SHARING_API_USER2) ->setSharedBy(self::TEST_FILES_SHARING_API_USER1) ->setPermissions(\OCP\Constants::PERMISSION_ALL); @@ -460,7 +460,7 @@ class CacheTest extends TestCase { $node = $rootFolder->get('foo'); $share = $this->shareManager->newShare(); $share->setNode($node) - ->setShareType(\OCP\Share::SHARE_TYPE_USER) + ->setShareType(IShare::TYPE_USER) ->setSharedWith(self::TEST_FILES_SHARING_API_USER2) ->setSharedBy(self::TEST_FILES_SHARING_API_USER1) ->setPermissions(\OCP\Constants::PERMISSION_ALL); @@ -497,7 +497,7 @@ class CacheTest extends TestCase { $node = $rootFolder->get('foo/sub'); $share = $this->shareManager->newShare(); $share->setNode($node) - ->setShareType(\OCP\Share::SHARE_TYPE_USER) + ->setShareType(IShare::TYPE_USER) ->setSharedWith(self::TEST_FILES_SHARING_API_USER2) ->setSharedBy(self::TEST_FILES_SHARING_API_USER1) ->setPermissions(\OCP\Constants::PERMISSION_ALL); diff --git a/apps/files_sharing/tests/Controller/ShareAPIControllerTest.php b/apps/files_sharing/tests/Controller/ShareAPIControllerTest.php index 577f574f8ed..e186092f0bf 100644 --- a/apps/files_sharing/tests/Controller/ShareAPIControllerTest.php +++ b/apps/files_sharing/tests/Controller/ShareAPIControllerTest.php @@ -52,7 +52,6 @@ use OCP\IURLGenerator; use OCP\IUser; use OCP\IUserManager; use OCP\Lock\LockedException; -use OCP\Share; use OCP\Share\Exceptions\GenericShareException; use OCP\Share\IManager; use OCP\Share\IShare; @@ -260,7 +259,7 @@ class ShareAPIControllerTest extends TestCase { $share = $this->newShare(); $share->setSharedWith($this->currentUser) - ->setShareType(\OCP\Share::SHARE_TYPE_USER) + ->setShareType(IShare::TYPE_USER) ->setNode($node); $this->shareManager @@ -355,7 +354,7 @@ class ShareAPIControllerTest extends TestCase { $node = $this->getMockBuilder(File::class)->getMock(); $share = $this->newShare(); - $share->setShareType(\OCP\Share::SHARE_TYPE_GROUP) + $share->setShareType(IShare::TYPE_GROUP) ->setSharedWith('group') ->setNode($node); @@ -417,7 +416,7 @@ class ShareAPIControllerTest extends TestCase { $node = $this->getMockBuilder(File::class)->getMock(); $share = $this->newShare(); - $share->setShareType(\OCP\Share::SHARE_TYPE_GROUP) + $share->setShareType(IShare::TYPE_GROUP) ->setSharedWith('group') ->setNode($node); @@ -504,9 +503,9 @@ class ShareAPIControllerTest extends TestCase { $share->method('getToken')->willReturn($token); $share->method('getPassword')->willReturn($password); - if ($shareType === \OCP\Share::SHARE_TYPE_USER || - $shareType === \OCP\Share::SHARE_TYPE_GROUP || - $shareType === \OCP\Share::SHARE_TYPE_LINK) { + if ($shareType === IShare::TYPE_USER || + $shareType === IShare::TYPE_GROUP || + $shareType === IShare::TYPE_LINK) { $share->method('getFullId')->willReturn('ocinternal:'.$id); } @@ -547,7 +546,7 @@ class ShareAPIControllerTest extends TestCase { // File shared with user $share = $this->createShare( 100, - \OCP\Share::SHARE_TYPE_USER, + IShare::TYPE_USER, 'userId', 'initiatorId', 'ownerId', @@ -562,7 +561,7 @@ class ShareAPIControllerTest extends TestCase { ); $expected = [ 'id' => 100, - 'share_type' => \OCP\Share::SHARE_TYPE_USER, + 'share_type' => IShare::TYPE_USER, 'share_with' => 'userId', 'share_with_displayname' => 'userDisplay', 'uid_owner' => 'initiatorId', @@ -595,7 +594,7 @@ class ShareAPIControllerTest extends TestCase { // Folder shared with group $share = $this->createShare( 101, - \OCP\Share::SHARE_TYPE_GROUP, + IShare::TYPE_GROUP, 'groupId', 'initiatorId', 'ownerId', @@ -610,7 +609,7 @@ class ShareAPIControllerTest extends TestCase { ); $expected = [ 'id' => 101, - 'share_type' => \OCP\Share::SHARE_TYPE_GROUP, + 'share_type' => IShare::TYPE_GROUP, 'share_with' => 'groupId', 'share_with_displayname' => 'groupId', 'uid_owner' => 'initiatorId', @@ -644,7 +643,7 @@ class ShareAPIControllerTest extends TestCase { $expire = \DateTime::createFromFormat('Y-m-d h:i:s', '2000-01-02 01:02:03'); $share = $this->createShare( 101, - \OCP\Share::SHARE_TYPE_LINK, + IShare::TYPE_LINK, null, 'initiatorId', 'ownerId', @@ -662,7 +661,7 @@ class ShareAPIControllerTest extends TestCase { ); $expected = [ 'id' => 101, - 'share_type' => \OCP\Share::SHARE_TYPE_LINK, + 'share_type' => IShare::TYPE_LINK, 'password' => 'password', 'share_with' => 'password', 'share_with_displayname' => '(Shared link)', @@ -1405,7 +1404,7 @@ class ShareAPIControllerTest extends TestCase { $this->assertTrue($this->invokePrivate($this->ocs, 'canAccessShare', [$share])); $share = $this->getMockBuilder(IShare::class)->getMock(); - $share->method('getShareType')->willReturn(\OCP\Share::SHARE_TYPE_USER); + $share->method('getShareType')->willReturn(IShare::TYPE_USER); $share->method('getSharedWith')->willReturn($this->currentUser); $this->assertTrue($this->invokePrivate($this->ocs, 'canAccessShare', [$share])); @@ -1425,18 +1424,18 @@ class ShareAPIControllerTest extends TestCase { // getPermissions -> share $share = $this->getMockBuilder(IShare::class)->getMock(); - $share->method('getShareType')->willReturn(\OCP\Share::SHARE_TYPE_USER); + $share->method('getShareType')->willReturn(IShare::TYPE_USER); $share->method('getSharedWith')->willReturn($this->getMockBuilder(IUser::class)->getMock()); $this->assertTrue($this->invokePrivate($this->ocs, 'canAccessShare', [$share])); // getPermissions -> read $share = $this->getMockBuilder(IShare::class)->getMock(); - $share->method('getShareType')->willReturn(\OCP\Share::SHARE_TYPE_USER); + $share->method('getShareType')->willReturn(IShare::TYPE_USER); $share->method('getSharedWith')->willReturn($this->getMockBuilder(IUser::class)->getMock()); $this->assertFalse($this->invokePrivate($this->ocs, 'canAccessShare', [$share])); $share = $this->getMockBuilder(IShare::class)->getMock(); - $share->method('getShareType')->willReturn(\OCP\Share::SHARE_TYPE_GROUP); + $share->method('getShareType')->willReturn(IShare::TYPE_GROUP); $share->method('getSharedWith')->willReturn('group'); $user = $this->createMock(IUser::class); @@ -1457,18 +1456,18 @@ class ShareAPIControllerTest extends TestCase { $this->assertTrue($this->invokePrivate($this->ocs, 'canAccessShare', [$share])); $share = $this->createMock(IShare::class); - $share->method('getShareType')->willReturn(\OCP\Share::SHARE_TYPE_GROUP); + $share->method('getShareType')->willReturn(IShare::TYPE_GROUP); $share->method('getSharedWith')->willReturn('group2'); $this->assertFalse($this->invokePrivate($this->ocs, 'canAccessShare', [$share])); // null group $share = $this->createMock(IShare::class); - $share->method('getShareType')->willReturn(\OCP\Share::SHARE_TYPE_GROUP); + $share->method('getShareType')->willReturn(IShare::TYPE_GROUP); $share->method('getSharedWith')->willReturn('groupnull'); $this->assertFalse($this->invokePrivate($this->ocs, 'canAccessShare', [$share])); $share = $this->createMock(IShare::class); - $share->method('getShareType')->willReturn(\OCP\Share::SHARE_TYPE_LINK); + $share->method('getShareType')->willReturn(IShare::TYPE_LINK); $this->assertFalse($this->invokePrivate($this->ocs, 'canAccessShare', [$share])); } @@ -1476,7 +1475,7 @@ class ShareAPIControllerTest extends TestCase { $result = []; $share = $this->createMock(IShare::class); - $share->method('getShareType')->willReturn(\OCP\Share::SHARE_TYPE_ROOM); + $share->method('getShareType')->willReturn(IShare::TYPE_ROOM); $share->method('getSharedWith')->willReturn('recipientRoom'); $result[] = [ @@ -1623,7 +1622,7 @@ class ShareAPIControllerTest extends TestCase { ->method('lock') ->with(\OCP\Lock\ILockingProvider::LOCK_SHARED); - $this->ocs->createShare('valid-path', \OCP\Constants::PERMISSION_ALL, \OCP\Share::SHARE_TYPE_USER); + $this->ocs->createShare('valid-path', \OCP\Constants::PERMISSION_ALL, IShare::TYPE_USER); } @@ -1657,7 +1656,7 @@ class ShareAPIControllerTest extends TestCase { ->with('invalidUser') ->willReturn(false); - $this->ocs->createShare('valid-path', \OCP\Constants::PERMISSION_ALL, \OCP\Share::SHARE_TYPE_USER, 'invalidUser'); + $this->ocs->createShare('valid-path', \OCP\Constants::PERMISSION_ALL, IShare::TYPE_USER, 'invalidUser'); } public function testCreateShareUser() { @@ -1713,14 +1712,14 @@ class ShareAPIControllerTest extends TestCase { ~\OCP\Constants::PERMISSION_DELETE & ~\OCP\Constants::PERMISSION_CREATE ) && - $share->getShareType() === \OCP\Share::SHARE_TYPE_USER && + $share->getShareType() === IShare::TYPE_USER && $share->getSharedWith() === 'validUser' && $share->getSharedBy() === 'currentUser'; })) ->willReturnArgument(0); $expected = new DataResponse([]); - $result = $ocs->createShare('valid-path', \OCP\Constants::PERMISSION_ALL, \OCP\Share::SHARE_TYPE_USER, 'validUser'); + $result = $ocs->createShare('valid-path', \OCP\Constants::PERMISSION_ALL, IShare::TYPE_USER, 'validUser'); $this->assertInstanceOf(get_class($expected), $result); $this->assertEquals($expected->getData(), $result->getData()); @@ -1757,7 +1756,7 @@ class ShareAPIControllerTest extends TestCase { ->method('lock') ->with(\OCP\Lock\ILockingProvider::LOCK_SHARED); - $this->ocs->createShare('valid-path', \OCP\Constants::PERMISSION_ALL, \OCP\Share::SHARE_TYPE_GROUP, 'invalidGroup'); + $this->ocs->createShare('valid-path', \OCP\Constants::PERMISSION_ALL, IShare::TYPE_GROUP, 'invalidGroup'); } public function testCreateShareGroup() { @@ -1787,7 +1786,7 @@ class ShareAPIControllerTest extends TestCase { ->willReturnMap([ ['path', null, 'valid-path'], ['permissions', null, \OCP\Constants::PERMISSION_ALL], - ['shareType', '-1', \OCP\Share::SHARE_TYPE_GROUP], + ['shareType', '-1', IShare::TYPE_GROUP], ['shareWith', null, 'validGroup'], ]); @@ -1822,14 +1821,14 @@ class ShareAPIControllerTest extends TestCase { ->with($this->callback(function (\OCP\Share\IShare $share) use ($path) { return $share->getNode() === $path && $share->getPermissions() === \OCP\Constants::PERMISSION_ALL && - $share->getShareType() === \OCP\Share::SHARE_TYPE_GROUP && + $share->getShareType() === IShare::TYPE_GROUP && $share->getSharedWith() === 'validGroup' && $share->getSharedBy() === 'currentUser'; })) ->willReturnArgument(0); $expected = new DataResponse([]); - $result = $ocs->createShare('valid-path', \OCP\Constants::PERMISSION_ALL, \OCP\Share::SHARE_TYPE_GROUP, 'validGroup'); + $result = $ocs->createShare('valid-path', \OCP\Constants::PERMISSION_ALL, IShare::TYPE_GROUP, 'validGroup'); $this->assertInstanceOf(get_class($expected), $result); $this->assertEquals($expected->getData(), $result->getData()); @@ -1866,7 +1865,7 @@ class ShareAPIControllerTest extends TestCase { ->method('allowGroupSharing') ->willReturn(false); - $this->ocs->createShare('valid-path', \OCP\Constants::PERMISSION_ALL, \OCP\Share::SHARE_TYPE_GROUP, 'invalidGroup'); + $this->ocs->createShare('valid-path', \OCP\Constants::PERMISSION_ALL, IShare::TYPE_GROUP, 'invalidGroup'); } @@ -1878,7 +1877,7 @@ class ShareAPIControllerTest extends TestCase { ->method('getParam') ->willReturnMap([ ['path', null, 'valid-path'], - ['shareType', '-1', \OCP\Share::SHARE_TYPE_LINK], + ['shareType', '-1', IShare::TYPE_LINK], ]); $path = $this->getMockBuilder(Folder::class)->getMock(); @@ -1892,7 +1891,7 @@ class ShareAPIControllerTest extends TestCase { $this->shareManager->method('newShare')->willReturn(\OC::$server->getShareManager()->newShare()); - $this->ocs->createShare('valid-path', \OCP\Constants::PERMISSION_ALL, \OCP\Share::SHARE_TYPE_LINK); + $this->ocs->createShare('valid-path', \OCP\Constants::PERMISSION_ALL, IShare::TYPE_LINK); } @@ -1912,7 +1911,7 @@ class ShareAPIControllerTest extends TestCase { $this->shareManager->method('newShare')->willReturn(\OC::$server->getShareManager()->newShare()); $this->shareManager->method('shareApiAllowLinks')->willReturn(true); - $this->ocs->createShare('valid-path', \OCP\Constants::PERMISSION_ALL, \OCP\Share::SHARE_TYPE_LINK, null, 'true'); + $this->ocs->createShare('valid-path', \OCP\Constants::PERMISSION_ALL, IShare::TYPE_LINK, null, 'true'); } @@ -1933,7 +1932,7 @@ class ShareAPIControllerTest extends TestCase { $this->shareManager->method('shareApiAllowLinks')->willReturn(true); $this->shareManager->method('shareApiLinkAllowPublicUpload')->willReturn(true); - $this->ocs->createShare('valid-path', \OCP\Constants::PERMISSION_ALL, \OCP\Share::SHARE_TYPE_LINK, null, 'true'); + $this->ocs->createShare('valid-path', \OCP\Constants::PERMISSION_ALL, IShare::TYPE_LINK, null, 'true'); } public function testCreateShareLinkPublicUploadFolder() { @@ -1955,7 +1954,7 @@ class ShareAPIControllerTest extends TestCase { $this->shareManager->expects($this->once())->method('createShare')->with( $this->callback(function (\OCP\Share\IShare $share) use ($path) { return $share->getNode() === $path && - $share->getShareType() === \OCP\Share::SHARE_TYPE_LINK && + $share->getShareType() === IShare::TYPE_LINK && $share->getPermissions() === (\OCP\Constants::PERMISSION_READ | \OCP\Constants::PERMISSION_CREATE | \OCP\Constants::PERMISSION_UPDATE | \OCP\Constants::PERMISSION_DELETE) && $share->getSharedBy() === 'currentUser' && $share->getPassword() === null && @@ -1964,7 +1963,7 @@ class ShareAPIControllerTest extends TestCase { )->willReturnArgument(0); $expected = new DataResponse([]); - $result = $ocs->createShare('valid-path', \OCP\Constants::PERMISSION_ALL, \OCP\Share::SHARE_TYPE_LINK, null, 'true', '', null, ''); + $result = $ocs->createShare('valid-path', \OCP\Constants::PERMISSION_ALL, IShare::TYPE_LINK, null, 'true', '', null, ''); $this->assertInstanceOf(get_class($expected), $result); $this->assertEquals($expected->getData(), $result->getData()); @@ -1989,7 +1988,7 @@ class ShareAPIControllerTest extends TestCase { $this->shareManager->expects($this->once())->method('createShare')->with( $this->callback(function (\OCP\Share\IShare $share) use ($path) { return $share->getNode() === $path && - $share->getShareType() === \OCP\Share::SHARE_TYPE_LINK && + $share->getShareType() === IShare::TYPE_LINK && $share->getPermissions() === \OCP\Constants::PERMISSION_READ && $share->getSharedBy() === 'currentUser' && $share->getPassword() === 'password' && @@ -1998,7 +1997,7 @@ class ShareAPIControllerTest extends TestCase { )->willReturnArgument(0); $expected = new DataResponse([]); - $result = $ocs->createShare('valid-path', \OCP\Constants::PERMISSION_ALL, \OCP\Share::SHARE_TYPE_LINK, null, 'false', 'password', null, ''); + $result = $ocs->createShare('valid-path', \OCP\Constants::PERMISSION_ALL, IShare::TYPE_LINK, null, 'false', 'password', null, ''); $this->assertInstanceOf(get_class($expected), $result); $this->assertEquals($expected->getData(), $result->getData()); @@ -2025,7 +2024,7 @@ class ShareAPIControllerTest extends TestCase { $this->shareManager->expects($this->once())->method('createShare')->with( $this->callback(function (\OCP\Share\IShare $share) use ($path) { return $share->getNode() === $path && - $share->getShareType() === \OCP\Share::SHARE_TYPE_LINK && + $share->getShareType() === IShare::TYPE_LINK && $share->getPermissions() === \OCP\Constants::PERMISSION_READ && $share->getSharedBy() === 'currentUser' && $share->getPassword() === 'password' && @@ -2035,7 +2034,7 @@ class ShareAPIControllerTest extends TestCase { )->willReturnArgument(0); $expected = new DataResponse([]); - $result = $ocs->createShare('valid-path', \OCP\Constants::PERMISSION_ALL, \OCP\Share::SHARE_TYPE_LINK, null, 'false', 'password', 'true', ''); + $result = $ocs->createShare('valid-path', \OCP\Constants::PERMISSION_ALL, IShare::TYPE_LINK, null, 'false', 'password', 'true', ''); $this->assertInstanceOf(get_class($expected), $result); $this->assertEquals($expected->getData(), $result->getData()); @@ -2066,7 +2065,7 @@ class ShareAPIControllerTest extends TestCase { $this->shareManager->expects($this->never())->method('createShare'); - $ocs->createShare('valid-path', \OCP\Constants::PERMISSION_ALL, \OCP\Share::SHARE_TYPE_LINK, null, 'false', 'password', 'true', ''); + $ocs->createShare('valid-path', \OCP\Constants::PERMISSION_ALL, IShare::TYPE_LINK, null, 'false', 'password', 'true', ''); } public function testCreateShareValidExpireDate() { @@ -2076,7 +2075,7 @@ class ShareAPIControllerTest extends TestCase { ->method('getParam') ->willReturnMap([ ['path', null, 'valid-path'], - ['shareType', '-1', \OCP\Share::SHARE_TYPE_LINK], + ['shareType', '-1', IShare::TYPE_LINK], ['publicUpload', null, 'false'], ['expireDate', '', '2000-01-01'], ['password', '', ''], @@ -2101,7 +2100,7 @@ class ShareAPIControllerTest extends TestCase { $date->setTime(0,0,0); return $share->getNode() === $path && - $share->getShareType() === \OCP\Share::SHARE_TYPE_LINK && + $share->getShareType() === IShare::TYPE_LINK && $share->getPermissions() === \OCP\Constants::PERMISSION_READ && $share->getSharedBy() === 'currentUser' && $share->getPassword() === null && @@ -2110,7 +2109,7 @@ class ShareAPIControllerTest extends TestCase { )->willReturnArgument(0); $expected = new DataResponse([]); - $result = $ocs->createShare('valid-path', \OCP\Constants::PERMISSION_ALL, \OCP\Share::SHARE_TYPE_LINK, null, 'false', '', null, '2000-01-01'); + $result = $ocs->createShare('valid-path', \OCP\Constants::PERMISSION_ALL, IShare::TYPE_LINK, null, 'false', '', null, '2000-01-01'); $this->assertInstanceOf(get_class($expected), $result); $this->assertEquals($expected->getData(), $result->getData()); @@ -2136,7 +2135,7 @@ class ShareAPIControllerTest extends TestCase { $this->shareManager->method('shareApiAllowLinks')->willReturn(true); $this->shareManager->method('shareApiLinkAllowPublicUpload')->willReturn(true); - $ocs->createShare('valid-path', \OCP\Constants::PERMISSION_ALL, \OCP\Share::SHARE_TYPE_LINK, null, 'false', '', null, 'a1b2d3'); + $ocs->createShare('valid-path', \OCP\Constants::PERMISSION_ALL, IShare::TYPE_LINK, null, 'false', '', null, 'a1b2d3'); } public function testCreateShareRoom() { @@ -2204,14 +2203,14 @@ class ShareAPIControllerTest extends TestCase { ~\OCP\Constants::PERMISSION_DELETE & ~\OCP\Constants::PERMISSION_CREATE ) && - $share->getShareType() === \OCP\Share::SHARE_TYPE_ROOM && + $share->getShareType() === IShare::TYPE_ROOM && $share->getSharedWith() === 'recipientRoom' && $share->getSharedBy() === 'currentUser'; })) ->willReturnArgument(0); $expected = new DataResponse([]); - $result = $ocs->createShare('valid-path', \OCP\Constants::PERMISSION_ALL, \OCP\Share::SHARE_TYPE_ROOM, 'recipientRoom'); + $result = $ocs->createShare('valid-path', \OCP\Constants::PERMISSION_ALL, IShare::TYPE_ROOM, 'recipientRoom'); $this->assertInstanceOf(get_class($expected), $result); $this->assertEquals($expected->getData(), $result->getData()); @@ -2255,7 +2254,7 @@ class ShareAPIControllerTest extends TestCase { $this->shareManager->expects($this->never())->method('createShare'); - $ocs->createShare('valid-path', \OCP\Constants::PERMISSION_ALL, \OCP\Share::SHARE_TYPE_ROOM, 'recipientRoom'); + $ocs->createShare('valid-path', \OCP\Constants::PERMISSION_ALL, IShare::TYPE_ROOM, 'recipientRoom'); } @@ -2316,7 +2315,7 @@ class ShareAPIControllerTest extends TestCase { $this->shareManager->expects($this->never())->method('createShare'); - $ocs->createShare('valid-path', \OCP\Constants::PERMISSION_ALL, \OCP\Share::SHARE_TYPE_ROOM, 'recipientRoom'); + $ocs->createShare('valid-path', \OCP\Constants::PERMISSION_ALL, IShare::TYPE_ROOM, 'recipientRoom'); } /** @@ -2373,7 +2372,7 @@ class ShareAPIControllerTest extends TestCase { })) ->willReturnArgument(0); - $ocs->createShare('valid-path', \OCP\Constants::PERMISSION_ALL, \OCP\Share::SHARE_TYPE_USER, 'validUser'); + $ocs->createShare('valid-path', \OCP\Constants::PERMISSION_ALL, IShare::TYPE_USER, 'validUser'); } @@ -2412,7 +2411,7 @@ class ShareAPIControllerTest extends TestCase { $share = $this->newShare(); $share->setPermissions(\OCP\Constants::PERMISSION_ALL) ->setSharedBy($this->currentUser) - ->setShareType(\OCP\Share::SHARE_TYPE_LINK) + ->setShareType(IShare::TYPE_LINK) ->setNode($node); $node->expects($this->once()) @@ -2433,7 +2432,7 @@ class ShareAPIControllerTest extends TestCase { $share = $this->newShare(); $share->setPermissions(\OCP\Constants::PERMISSION_ALL) ->setSharedBy($this->currentUser) - ->setShareType(\OCP\Share::SHARE_TYPE_GROUP) + ->setShareType(IShare::TYPE_GROUP) ->setNode($node); $node->expects($this->once()) @@ -2454,7 +2453,7 @@ class ShareAPIControllerTest extends TestCase { $share = $this->newShare(); $share->setPermissions(\OCP\Constants::PERMISSION_ALL) ->setSharedBy($this->currentUser) - ->setShareType(\OCP\Share::SHARE_TYPE_LINK) + ->setShareType(IShare::TYPE_LINK) ->setPassword('password') ->setExpirationDate(new \DateTime()) ->setNote('note') @@ -2517,7 +2516,7 @@ class ShareAPIControllerTest extends TestCase { $share = \OC::$server->getShareManager()->newShare(); $share->setPermissions(\OCP\Constants::PERMISSION_ALL) ->setSharedBy($this->currentUser) - ->setShareType(\OCP\Share::SHARE_TYPE_LINK) + ->setShareType(IShare::TYPE_LINK) ->setNode($folder); $this->shareManager->method('getShareById')->with('ocinternal:42')->willReturn($share); @@ -2575,7 +2574,7 @@ class ShareAPIControllerTest extends TestCase { $share = \OC::$server->getShareManager()->newShare(); $share->setPermissions(\OCP\Constants::PERMISSION_ALL) ->setSharedBy($this->currentUser) - ->setShareType(\OCP\Share::SHARE_TYPE_LINK) + ->setShareType(IShare::TYPE_LINK) ->setPassword('password') ->setNode($folder); @@ -2625,7 +2624,7 @@ class ShareAPIControllerTest extends TestCase { $share = \OC::$server->getShareManager()->newShare(); $share->setPermissions(\OCP\Constants::PERMISSION_ALL) ->setSharedBy($this->currentUser) - ->setShareType(\OCP\Share::SHARE_TYPE_LINK) + ->setShareType(IShare::TYPE_LINK) ->setNode($folder); $this->shareManager->method('getShareById')->with('ocinternal:42')->willReturn($share); @@ -2664,7 +2663,7 @@ class ShareAPIControllerTest extends TestCase { $share = \OC::$server->getShareManager()->newShare(); $share->setPermissions(\OCP\Constants::PERMISSION_ALL) ->setSharedBy($this->currentUser) - ->setShareType(\OCP\Share::SHARE_TYPE_LINK) + ->setShareType(IShare::TYPE_LINK) ->setNode($folder); $this->shareManager->method('getShareById')->with('ocinternal:42')->willReturn($share); @@ -2685,7 +2684,7 @@ class ShareAPIControllerTest extends TestCase { $share = \OC::$server->getShareManager()->newShare(); $share->setPermissions(\OCP\Constants::PERMISSION_ALL) ->setSharedBy($this->currentUser) - ->setShareType(\OCP\Share::SHARE_TYPE_LINK) + ->setShareType(IShare::TYPE_LINK) ->setNode($file); $this->shareManager->method('getShareById')->with('ocinternal:42')->willReturn($share); @@ -2704,7 +2703,7 @@ class ShareAPIControllerTest extends TestCase { $share = $this->newShare(); $share->setPermissions(\OCP\Constants::PERMISSION_ALL) ->setSharedBy($this->currentUser) - ->setShareType(\OCP\Share::SHARE_TYPE_LINK) + ->setShareType(IShare::TYPE_LINK) ->setPassword('password') ->setSendPasswordByTalk(true) ->setExpirationDate($date) @@ -2749,7 +2748,7 @@ class ShareAPIControllerTest extends TestCase { $share = $this->newShare(); $share->setPermissions(\OCP\Constants::PERMISSION_ALL) ->setSharedBy($this->currentUser) - ->setShareType(\OCP\Share::SHARE_TYPE_LINK) + ->setShareType(IShare::TYPE_LINK) ->setPassword('password') ->setSendPasswordByTalk(false) ->setExpirationDate($date) @@ -2800,7 +2799,7 @@ class ShareAPIControllerTest extends TestCase { $share = $this->newShare(); $share->setPermissions(\OCP\Constants::PERMISSION_ALL) ->setSharedBy($this->currentUser) - ->setShareType(\OCP\Share::SHARE_TYPE_LINK) + ->setShareType(IShare::TYPE_LINK) ->setPassword('password') ->setSendPasswordByTalk(false) ->setExpirationDate($date) @@ -2833,7 +2832,7 @@ class ShareAPIControllerTest extends TestCase { $share = $this->newShare(); $share->setPermissions(\OCP\Constants::PERMISSION_ALL) ->setSharedBy($this->currentUser) - ->setShareType(\OCP\Share::SHARE_TYPE_LINK) + ->setShareType(IShare::TYPE_LINK) ->setPassword('password') ->setSendPasswordByTalk(true) ->setExpirationDate($date) @@ -2883,7 +2882,7 @@ class ShareAPIControllerTest extends TestCase { $share = $this->newShare(); $share->setPermissions(\OCP\Constants::PERMISSION_ALL) ->setSharedBy($this->currentUser) - ->setShareType(\OCP\Share::SHARE_TYPE_LINK) + ->setShareType(IShare::TYPE_LINK) ->setPassword('password') ->setSendPasswordByTalk(true) ->setExpirationDate($date) @@ -2951,7 +2950,7 @@ class ShareAPIControllerTest extends TestCase { $share = $this->newShare(); $share->setPermissions(\OCP\Constants::PERMISSION_ALL) ->setSharedBy($this->currentUser) - ->setShareType(\OCP\Share::SHARE_TYPE_LINK) + ->setShareType(IShare::TYPE_LINK) ->setPassword('password') ->setSendPasswordByTalk(true) ->setExpirationDate(new \DateTime()) @@ -3016,7 +3015,7 @@ class ShareAPIControllerTest extends TestCase { $share = \OC::$server->getShareManager()->newShare(); $share->setPermissions(\OCP\Constants::PERMISSION_ALL) ->setSharedBy($this->currentUser) - ->setShareType(\OCP\Share::SHARE_TYPE_LINK) + ->setShareType(IShare::TYPE_LINK) ->setPassword('password') ->setSendPasswordByTalk(true) ->setExpirationDate($date) @@ -3078,7 +3077,7 @@ class ShareAPIControllerTest extends TestCase { $share = \OC::$server->getShareManager()->newShare(); $share->setPermissions(\OCP\Constants::PERMISSION_ALL) ->setSharedBy($this->currentUser) - ->setShareType(\OCP\Share::SHARE_TYPE_LINK) + ->setShareType(IShare::TYPE_LINK) ->setPassword('password') ->setSendPasswordByTalk(true) ->setExpirationDate($date) @@ -3139,7 +3138,7 @@ class ShareAPIControllerTest extends TestCase { $share = \OC::$server->getShareManager()->newShare(); $share->setPermissions(\OCP\Constants::PERMISSION_ALL) ->setSharedBy($this->currentUser) - ->setShareType(\OCP\Share::SHARE_TYPE_LINK) + ->setShareType(IShare::TYPE_LINK) ->setPassword('password') ->setSendPasswordByTalk(true) ->setExpirationDate($date) @@ -3198,7 +3197,7 @@ class ShareAPIControllerTest extends TestCase { $share = \OC::$server->getShareManager()->newShare(); $share->setPermissions(\OCP\Constants::PERMISSION_ALL) ->setSharedBy($this->currentUser) - ->setShareType(\OCP\Share::SHARE_TYPE_USER) + ->setShareType(IShare::TYPE_USER) ->setNode($file); $this->shareManager->method('getShareById')->with('ocinternal:42')->willReturn($share); @@ -3246,7 +3245,7 @@ class ShareAPIControllerTest extends TestCase { ->setId(42) ->setSharedBy($this->currentUser) ->setShareOwner('anotheruser') - ->setShareType(\OCP\Share::SHARE_TYPE_GROUP) + ->setShareType(IShare::TYPE_GROUP) ->setSharedWith('group1') ->setPermissions(\OCP\Constants::PERMISSION_READ) ->setNode($folder); @@ -3258,7 +3257,7 @@ class ShareAPIControllerTest extends TestCase { ->setId(42) ->setSharedBy($this->currentUser) ->setShareOwner('anotheruser') - ->setShareType(\OCP\Share::SHARE_TYPE_GROUP) + ->setShareType(IShare::TYPE_GROUP) ->setSharedWith('group1') ->setPermissions(\OCP\Constants::PERMISSION_READ) ->setNode($folder); @@ -3274,9 +3273,9 @@ class ShareAPIControllerTest extends TestCase { $this->shareManager->expects($this->any()) ->method('getSharedWith') ->willReturnMap([ - ['currentUser', \OCP\Share::SHARE_TYPE_USER, $share->getNode(), -1, 0, []], - ['currentUser', \OCP\Share::SHARE_TYPE_GROUP, $share->getNode(), -1, 0, [$incomingShare]], - ['currentUser', \OCP\Share::SHARE_TYPE_ROOM, $share->getNode(), -1, 0, []] + ['currentUser', IShare::TYPE_USER, $share->getNode(), -1, 0, []], + ['currentUser', IShare::TYPE_GROUP, $share->getNode(), -1, 0, [$incomingShare]], + ['currentUser', IShare::TYPE_ROOM, $share->getNode(), -1, 0, []] ]); $userFolder = $this->createMock(Folder::class); @@ -3319,7 +3318,7 @@ class ShareAPIControllerTest extends TestCase { ->setId(42) ->setSharedBy($this->currentUser) ->setShareOwner($this->currentUser) - ->setShareType(\OCP\Share::SHARE_TYPE_GROUP) + ->setShareType(IShare::TYPE_GROUP) ->setSharedWith('group1') ->setPermissions(\OCP\Constants::PERMISSION_READ) ->setNode($folder); @@ -3331,7 +3330,7 @@ class ShareAPIControllerTest extends TestCase { ->setId(42) ->setSharedBy($this->currentUser) ->setShareOwner($this->currentUser) - ->setShareType(\OCP\Share::SHARE_TYPE_GROUP) + ->setShareType(IShare::TYPE_GROUP) ->setSharedWith('group1') ->setPermissions(\OCP\Constants::PERMISSION_READ) ->setNode($folder); @@ -3341,8 +3340,8 @@ class ShareAPIControllerTest extends TestCase { $this->shareManager->expects($this->any()) ->method('getSharedWith') ->willReturnMap([ - ['currentUser', \OCP\Share::SHARE_TYPE_USER, $share->getNode(), -1, 0, []], - ['currentUser', \OCP\Share::SHARE_TYPE_GROUP, $share->getNode(), -1, 0, [$incomingShare]] + ['currentUser', IShare::TYPE_USER, $share->getNode(), -1, 0, []], + ['currentUser', IShare::TYPE_GROUP, $share->getNode(), -1, 0, [$incomingShare]] ]); $this->shareManager->expects($this->once()) @@ -3406,7 +3405,7 @@ class ShareAPIControllerTest extends TestCase { $result = []; $share = \OC::$server->getShareManager()->newShare(); - $share->setShareType(\OCP\Share::SHARE_TYPE_USER) + $share->setShareType(IShare::TYPE_USER) ->setSharedWith('recipient') ->setSharedBy('initiator') ->setShareOwner('owner') @@ -3421,7 +3420,7 @@ class ShareAPIControllerTest extends TestCase { $result[] = [ [ 'id' => 42, - 'share_type' => \OCP\Share::SHARE_TYPE_USER, + 'share_type' => IShare::TYPE_USER, 'uid_owner' => 'initiator', 'displayname_owner' => 'initiator', 'permissions' => 1, @@ -3454,7 +3453,7 @@ class ShareAPIControllerTest extends TestCase { $result[] = [ [ 'id' => 42, - 'share_type' => \OCP\Share::SHARE_TYPE_USER, + 'share_type' => IShare::TYPE_USER, 'uid_owner' => 'initiator', 'displayname_owner' => 'initiatorDN', 'permissions' => 1, @@ -3489,7 +3488,7 @@ class ShareAPIControllerTest extends TestCase { ]; $share = \OC::$server->getShareManager()->newShare(); - $share->setShareType(\OCP\Share::SHARE_TYPE_USER) + $share->setShareType(IShare::TYPE_USER) ->setSharedWith('recipient') ->setSharedBy('initiator') ->setShareOwner('owner') @@ -3503,7 +3502,7 @@ class ShareAPIControllerTest extends TestCase { $result[] = [ [ 'id' => 42, - 'share_type' => \OCP\Share::SHARE_TYPE_USER, + 'share_type' => IShare::TYPE_USER, 'uid_owner' => 'initiator', 'displayname_owner' => 'initiator', 'permissions' => 1, @@ -3534,7 +3533,7 @@ class ShareAPIControllerTest extends TestCase { ]; $share = \OC::$server->getShareManager()->newShare(); - $share->setShareType(\OCP\Share::SHARE_TYPE_USER) + $share->setShareType(IShare::TYPE_USER) ->setSharedWith('recipient') ->setSharedBy('initiator') ->setShareOwner('currentUser') @@ -3548,7 +3547,7 @@ class ShareAPIControllerTest extends TestCase { $result[] = [ [ 'id' => 42, - 'share_type' => \OCP\Share::SHARE_TYPE_USER, + 'share_type' => IShare::TYPE_USER, 'uid_owner' => 'initiator', 'displayname_owner' => 'initiator', 'permissions' => 1, @@ -3581,7 +3580,7 @@ class ShareAPIControllerTest extends TestCase { // with existing group $share = \OC::$server->getShareManager()->newShare(); - $share->setShareType(\OCP\Share::SHARE_TYPE_GROUP) + $share->setShareType(IShare::TYPE_GROUP) ->setSharedWith('recipientGroup') ->setSharedBy('initiator') ->setShareOwner('owner') @@ -3595,7 +3594,7 @@ class ShareAPIControllerTest extends TestCase { $result[] = [ [ 'id' => 42, - 'share_type' => \OCP\Share::SHARE_TYPE_GROUP, + 'share_type' => IShare::TYPE_GROUP, 'uid_owner' => 'initiator', 'displayname_owner' => 'initiator', 'permissions' => 1, @@ -3627,7 +3626,7 @@ class ShareAPIControllerTest extends TestCase { // with unknown group / no group backend $share = \OC::$server->getShareManager()->newShare(); - $share->setShareType(Share::SHARE_TYPE_GROUP) + $share->setShareType(IShare::TYPE_GROUP) ->setSharedWith('recipientGroup2') ->setSharedBy('initiator') ->setShareOwner('owner') @@ -3640,7 +3639,7 @@ class ShareAPIControllerTest extends TestCase { $result[] = [ [ 'id' => 42, - 'share_type' => Share::SHARE_TYPE_GROUP, + 'share_type' => IShare::TYPE_GROUP, 'uid_owner' => 'initiator', 'displayname_owner' => 'initiator', 'permissions' => 1, @@ -3671,7 +3670,7 @@ class ShareAPIControllerTest extends TestCase { ]; $share = \OC::$server->getShareManager()->newShare(); - $share->setShareType(\OCP\Share::SHARE_TYPE_LINK) + $share->setShareType(IShare::TYPE_LINK) ->setSharedBy('initiator') ->setShareOwner('owner') ->setPermissions(\OCP\Constants::PERMISSION_READ) @@ -3688,7 +3687,7 @@ class ShareAPIControllerTest extends TestCase { $result[] = [ [ 'id' => 42, - 'share_type' => \OCP\Share::SHARE_TYPE_LINK, + 'share_type' => IShare::TYPE_LINK, 'uid_owner' => 'initiator', 'displayname_owner' => 'initiator', 'permissions' => 1, @@ -3722,7 +3721,7 @@ class ShareAPIControllerTest extends TestCase { ]; $share = \OC::$server->getShareManager()->newShare(); - $share->setShareType(\OCP\Share::SHARE_TYPE_LINK) + $share->setShareType(IShare::TYPE_LINK) ->setSharedBy('initiator') ->setShareOwner('owner') ->setPermissions(\OCP\Constants::PERMISSION_READ) @@ -3740,7 +3739,7 @@ class ShareAPIControllerTest extends TestCase { $result[] = [ [ 'id' => 42, - 'share_type' => \OCP\Share::SHARE_TYPE_LINK, + 'share_type' => IShare::TYPE_LINK, 'uid_owner' => 'initiator', 'displayname_owner' => 'initiator', 'permissions' => 1, @@ -3774,7 +3773,7 @@ class ShareAPIControllerTest extends TestCase { ]; $share = \OC::$server->getShareManager()->newShare(); - $share->setShareType(\OCP\Share::SHARE_TYPE_REMOTE) + $share->setShareType(IShare::TYPE_REMOTE) ->setSharedBy('initiator') ->setSharedWith('user@server.com') ->setShareOwner('owner') @@ -3788,7 +3787,7 @@ class ShareAPIControllerTest extends TestCase { $result[] = [ [ 'id' => 42, - 'share_type' => \OCP\Share::SHARE_TYPE_REMOTE, + 'share_type' => IShare::TYPE_REMOTE, 'uid_owner' => 'initiator', 'displayname_owner' => 'initiator', 'permissions' => 1, @@ -3820,7 +3819,7 @@ class ShareAPIControllerTest extends TestCase { // Circle with id, display name and avatar set by the Circles app $share = \OC::$server->getShareManager()->newShare(); - $share->setShareType(\OCP\Share::SHARE_TYPE_CIRCLE) + $share->setShareType(IShare::TYPE_CIRCLE) ->setSharedBy('initiator') ->setSharedWith('Circle (Public circle, circleOwner) [4815162342]') ->setSharedWithDisplayName('The display name') @@ -3835,7 +3834,7 @@ class ShareAPIControllerTest extends TestCase { $result[] = [ [ 'id' => 42, - 'share_type' => \OCP\Share::SHARE_TYPE_CIRCLE, + 'share_type' => IShare::TYPE_CIRCLE, 'uid_owner' => 'initiator', 'displayname_owner' => 'initiator', 'permissions' => 1, @@ -3868,7 +3867,7 @@ class ShareAPIControllerTest extends TestCase { // Circle with id set by the Circles app $share = \OC::$server->getShareManager()->newShare(); - $share->setShareType(\OCP\Share::SHARE_TYPE_CIRCLE) + $share->setShareType(IShare::TYPE_CIRCLE) ->setSharedBy('initiator') ->setSharedWith('Circle (Public circle, circleOwner) [4815162342]') ->setShareOwner('owner') @@ -3881,7 +3880,7 @@ class ShareAPIControllerTest extends TestCase { $result[] = [ [ 'id' => 42, - 'share_type' => \OCP\Share::SHARE_TYPE_CIRCLE, + 'share_type' => IShare::TYPE_CIRCLE, 'uid_owner' => 'initiator', 'displayname_owner' => 'initiator', 'permissions' => 1, @@ -3914,7 +3913,7 @@ class ShareAPIControllerTest extends TestCase { // Circle with id not set by the Circles app $share = \OC::$server->getShareManager()->newShare(); - $share->setShareType(\OCP\Share::SHARE_TYPE_CIRCLE) + $share->setShareType(IShare::TYPE_CIRCLE) ->setSharedBy('initiator') ->setSharedWith('Circle (Public circle, circleOwner)') ->setShareOwner('owner') @@ -3927,7 +3926,7 @@ class ShareAPIControllerTest extends TestCase { $result[] = [ [ 'id' => 42, - 'share_type' => \OCP\Share::SHARE_TYPE_CIRCLE, + 'share_type' => IShare::TYPE_CIRCLE, 'uid_owner' => 'initiator', 'displayname_owner' => 'initiator', 'permissions' => 1, @@ -3959,7 +3958,7 @@ class ShareAPIControllerTest extends TestCase { ]; $share = \OC::$server->getShareManager()->newShare(); - $share->setShareType(\OCP\Share::SHARE_TYPE_USER) + $share->setShareType(IShare::TYPE_USER) ->setSharedBy('initiator') ->setSharedWith('recipient') ->setShareOwner('owner') @@ -3974,7 +3973,7 @@ class ShareAPIControllerTest extends TestCase { ]; $share = \OC::$server->getShareManager()->newShare(); - $share->setShareType(\OCP\Share::SHARE_TYPE_EMAIL) + $share->setShareType(IShare::TYPE_EMAIL) ->setSharedBy('initiator') ->setSharedWith('user@server.com') ->setShareOwner('owner') @@ -3988,7 +3987,7 @@ class ShareAPIControllerTest extends TestCase { $result[] = [ [ 'id' => 42, - 'share_type' => \OCP\Share::SHARE_TYPE_EMAIL, + 'share_type' => IShare::TYPE_EMAIL, 'uid_owner' => 'initiator', 'displayname_owner' => 'initiator', 'permissions' => 1, @@ -4021,7 +4020,7 @@ class ShareAPIControllerTest extends TestCase { ]; $share = \OC::$server->getShareManager()->newShare(); - $share->setShareType(\OCP\Share::SHARE_TYPE_EMAIL) + $share->setShareType(IShare::TYPE_EMAIL) ->setSharedBy('initiator') ->setSharedWith('user@server.com') ->setShareOwner('owner') @@ -4036,7 +4035,7 @@ class ShareAPIControllerTest extends TestCase { $result[] = [ [ 'id' => 42, - 'share_type' => \OCP\Share::SHARE_TYPE_EMAIL, + 'share_type' => IShare::TYPE_EMAIL, 'uid_owner' => 'initiator', 'displayname_owner' => 'initiator', 'permissions' => 1, @@ -4167,7 +4166,7 @@ class ShareAPIControllerTest extends TestCase { $result = []; $share = \OC::$server->getShareManager()->newShare(); - $share->setShareType(\OCP\Share::SHARE_TYPE_ROOM) + $share->setShareType(IShare::TYPE_ROOM) ->setSharedWith('recipientRoom') ->setSharedBy('initiator') ->setShareOwner('owner') @@ -4181,7 +4180,7 @@ class ShareAPIControllerTest extends TestCase { $result[] = [ [ 'id' => 42, - 'share_type' => \OCP\Share::SHARE_TYPE_ROOM, + 'share_type' => IShare::TYPE_ROOM, 'uid_owner' => 'initiator', 'displayname_owner' => 'initiator', 'permissions' => 1, @@ -4212,7 +4211,7 @@ class ShareAPIControllerTest extends TestCase { ]; $share = \OC::$server->getShareManager()->newShare(); - $share->setShareType(\OCP\Share::SHARE_TYPE_ROOM) + $share->setShareType(IShare::TYPE_ROOM) ->setSharedWith('recipientRoom') ->setSharedBy('initiator') ->setShareOwner('owner') @@ -4226,7 +4225,7 @@ class ShareAPIControllerTest extends TestCase { $result[] = [ [ 'id' => 42, - 'share_type' => \OCP\Share::SHARE_TYPE_ROOM, + 'share_type' => IShare::TYPE_ROOM, 'uid_owner' => 'initiator', 'displayname_owner' => 'initiator', 'permissions' => 1, diff --git a/apps/files_sharing/tests/Controller/ShareesAPIControllerTest.php b/apps/files_sharing/tests/Controller/ShareesAPIControllerTest.php index 7beb4058c4f..8939198d4a8 100644 --- a/apps/files_sharing/tests/Controller/ShareesAPIControllerTest.php +++ b/apps/files_sharing/tests/Controller/ShareesAPIControllerTest.php @@ -38,7 +38,7 @@ use OCP\Collaboration\Collaborators\ISearch; use OCP\IConfig; use OCP\IRequest; use OCP\IURLGenerator; -use OCP\Share; +use OCP\Share\IShare; use OCP\Share\IManager; /** @@ -91,8 +91,8 @@ class ShareesAPIControllerTest extends TestCase { } public function dataSearch() { - $noRemote = [Share::SHARE_TYPE_USER, Share::SHARE_TYPE_GROUP, Share::SHARE_TYPE_EMAIL]; - $allTypes = [Share::SHARE_TYPE_USER, Share::SHARE_TYPE_GROUP, Share::SHARE_TYPE_REMOTE, Share::SHARE_TYPE_REMOTE_GROUP, Share::SHARE_TYPE_EMAIL]; + $noRemote = [IShare::TYPE_USER, IShare::TYPE_GROUP, IShare::TYPE_EMAIL]; + $allTypes = [IShare::TYPE_USER, IShare::TYPE_GROUP, IShare::TYPE_REMOTE, IShare::TYPE_REMOTE_GROUP, IShare::TYPE_EMAIL]; return [ [[], '', 'yes', true, true, true, $noRemote, false, true, true], @@ -293,7 +293,7 @@ class ShareesAPIControllerTest extends TestCase { $this->shareManager->expects($this->any()) ->method('shareProviderExists') ->willReturnCallback(function ($shareType) use ($emailSharingEnabled) { - if ($shareType === \OCP\Share::SHARE_TYPE_EMAIL) { + if ($shareType === \OCP\IShare::TYPE_EMAIL) { return $emailSharingEnabled; } else { return false; diff --git a/apps/files_sharing/tests/DeleteOrphanedSharesJobTest.php b/apps/files_sharing/tests/DeleteOrphanedSharesJobTest.php index f081c947f53..3936a3b9da2 100644 --- a/apps/files_sharing/tests/DeleteOrphanedSharesJobTest.php +++ b/apps/files_sharing/tests/DeleteOrphanedSharesJobTest.php @@ -27,6 +27,7 @@ namespace OCA\Files_Sharing\Tests; use OCA\Files_Sharing\DeleteOrphanedSharesJob; +use OCP\Share\IShare; /** * Class DeleteOrphanedSharesJobTest @@ -138,7 +139,7 @@ class DeleteOrphanedSharesJobTest extends \Test\TestCase { $share = $shareManager->newShare(); $share->setNode($testSubFolder) - ->setShareType(\OCP\Share::SHARE_TYPE_USER) + ->setShareType(IShare::TYPE_USER) ->setPermissions(\OCP\Constants::PERMISSION_READ) ->setSharedWith($this->user2) ->setSharedBy($this->user1); diff --git a/apps/files_sharing/tests/EtagPropagationTest.php b/apps/files_sharing/tests/EtagPropagationTest.php index 081b720f820..ee2f5b204e3 100644 --- a/apps/files_sharing/tests/EtagPropagationTest.php +++ b/apps/files_sharing/tests/EtagPropagationTest.php @@ -31,6 +31,7 @@ namespace OCA\Files_Sharing\Tests; use OC\Files\Filesystem; use OC\Files\View; +use OCP\Share\IShare; /** * Class EtagPropagationTest @@ -75,7 +76,7 @@ class EtagPropagationTest extends PropagationTestCase { ->get('/foo.txt'); $share = $shareManager->newShare(); $share->setNode($node) - ->setShareType(\OCP\Share::SHARE_TYPE_USER) + ->setShareType(IShare::TYPE_USER) ->setSharedWith(self::TEST_FILES_SHARING_API_USER2) ->setSharedBy(self::TEST_FILES_SHARING_API_USER1) ->setPermissions(\OCP\Constants::PERMISSION_READ | \OCP\Constants::PERMISSION_UPDATE | \OCP\Constants::PERMISSION_SHARE); @@ -86,7 +87,7 @@ class EtagPropagationTest extends PropagationTestCase { $share = $shareManager->newShare(); $share->setNode($node) - ->setShareType(\OCP\Share::SHARE_TYPE_USER) + ->setShareType(IShare::TYPE_USER) ->setSharedWith(self::TEST_FILES_SHARING_API_USER2) ->setSharedBy(self::TEST_FILES_SHARING_API_USER1) ->setPermissions(\OCP\Constants::PERMISSION_ALL); @@ -95,7 +96,7 @@ class EtagPropagationTest extends PropagationTestCase { $share = $shareManager->newShare(); $share->setNode($node) - ->setShareType(\OCP\Share::SHARE_TYPE_USER) + ->setShareType(IShare::TYPE_USER) ->setSharedWith(self::TEST_FILES_SHARING_API_USER3) ->setSharedBy(self::TEST_FILES_SHARING_API_USER1) ->setPermissions(\OCP\Constants::PERMISSION_ALL); @@ -109,7 +110,7 @@ class EtagPropagationTest extends PropagationTestCase { ->get('/directReshare'); $share = $shareManager->newShare(); $share->setNode($node) - ->setShareType(\OCP\Share::SHARE_TYPE_USER) + ->setShareType(IShare::TYPE_USER) ->setSharedWith(self::TEST_FILES_SHARING_API_USER2) ->setSharedBy(self::TEST_FILES_SHARING_API_USER1) ->setPermissions(\OCP\Constants::PERMISSION_ALL); @@ -134,7 +135,7 @@ class EtagPropagationTest extends PropagationTestCase { ->get('/sub1/sub2/folder/inside'); $share = $shareManager->newShare(); $share->setNode($node) - ->setShareType(\OCP\Share::SHARE_TYPE_USER) + ->setShareType(IShare::TYPE_USER) ->setSharedWith(self::TEST_FILES_SHARING_API_USER4) ->setSharedBy(self::TEST_FILES_SHARING_API_USER2) ->setPermissions(\OCP\Constants::PERMISSION_ALL); @@ -148,7 +149,7 @@ class EtagPropagationTest extends PropagationTestCase { ->get('/directReshare'); $share = $shareManager->newShare(); $share->setNode($node) - ->setShareType(\OCP\Share::SHARE_TYPE_USER) + ->setShareType(IShare::TYPE_USER) ->setSharedWith(self::TEST_FILES_SHARING_API_USER4) ->setSharedBy(self::TEST_FILES_SHARING_API_USER2) ->setPermissions(\OCP\Constants::PERMISSION_ALL); @@ -284,7 +285,7 @@ class EtagPropagationTest extends PropagationTestCase { $node = \OC::$server->getUserFolder(self::TEST_FILES_SHARING_API_USER1)->get('/sub1/sub2/folder'); $shareManager = \OC::$server->getShareManager(); - $shares = $shareManager->getSharesBy(self::TEST_FILES_SHARING_API_USER1, \OCP\Share::SHARE_TYPE_USER, $node, true); + $shares = $shareManager->getSharesBy(self::TEST_FILES_SHARING_API_USER1, IShare::TYPE_USER, $node, true); foreach ($shares as $share) { if ($share->getSharedWith() === self::TEST_FILES_SHARING_API_USER2) { @@ -307,7 +308,7 @@ class EtagPropagationTest extends PropagationTestCase { $node = \OC::$server->getUserFolder(self::TEST_FILES_SHARING_API_USER1)->get('/sub1/sub2/folder/inside'); $shareManager = \OC::$server->getShareManager(); - $shares = $shareManager->getSharesBy(self::TEST_FILES_SHARING_API_USER1, \OCP\Share::SHARE_TYPE_USER, $node, true); + $shares = $shareManager->getSharesBy(self::TEST_FILES_SHARING_API_USER1, IShare::TYPE_USER, $node, true); foreach ($shares as $share) { $shareManager->deleteShare($share); @@ -455,7 +456,7 @@ class EtagPropagationTest extends PropagationTestCase { $userFolder = $this->rootFolder->getUserFolder(self::TEST_FILES_SHARING_API_USER1); $node = $userFolder->get('/sub1/sub2/folder'); - $shares = $this->shareManager->getSharesBy(self::TEST_FILES_SHARING_API_USER1, \OCP\Share::SHARE_TYPE_USER, $node); + $shares = $this->shareManager->getSharesBy(self::TEST_FILES_SHARING_API_USER1, IShare::TYPE_USER, $node); /** @var \OCP\Share\IShare[] $shares */ $shares = array_filter($shares, function (\OCP\Share\IShare $share) { return $share->getSharedWith() === self::TEST_FILES_SHARING_API_USER2; diff --git a/apps/files_sharing/tests/ExpireSharesJobTest.php b/apps/files_sharing/tests/ExpireSharesJobTest.php index 1854ce4990c..219a91a2829 100644 --- a/apps/files_sharing/tests/ExpireSharesJobTest.php +++ b/apps/files_sharing/tests/ExpireSharesJobTest.php @@ -25,6 +25,7 @@ namespace OCA\Files_Sharing\Tests; use OCA\Files_Sharing\ExpireSharesJob; +use OCP\Share\IShare; /** * Class ExpireSharesJobTest @@ -140,7 +141,7 @@ class ExpireSharesJobTest extends \Test\TestCase { $share = $shareManager->newShare(); $share->setNode($testFolder) - ->setShareType(\OCP\Share::SHARE_TYPE_LINK) + ->setShareType(IShare::TYPE_LINK) ->setPermissions(\OCP\Constants::PERMISSION_READ) ->setSharedBy($this->user1); @@ -197,7 +198,7 @@ class ExpireSharesJobTest extends \Test\TestCase { $share = $shareManager->newShare(); $share->setNode($testFolder) - ->setShareType(\OCP\Share::SHARE_TYPE_USER) + ->setShareType(IShare::TYPE_USER) ->setPermissions(\OCP\Constants::PERMISSION_READ) ->setSharedBy($this->user1) ->setSharedWith($this->user2); diff --git a/apps/files_sharing/tests/External/ManagerTest.php b/apps/files_sharing/tests/External/ManagerTest.php index 5807c3e9fd5..d6fab64dc67 100644 --- a/apps/files_sharing/tests/External/ManagerTest.php +++ b/apps/files_sharing/tests/External/ManagerTest.php @@ -39,6 +39,7 @@ use OCP\Http\Client\IClientService; use OCP\Http\Client\IResponse; use OCP\IGroupManager; use OCP\IUserManager; +use OCP\Share\IShare; use Test\Traits\UserTrait; /** @@ -130,7 +131,7 @@ class ManagerTest extends TestCase { 'password' => '', 'name' => '/SharedFolder', 'owner' => 'foobar', - 'shareType' => \OCP\Share::SHARE_TYPE_USER, + 'shareType' => IShare::TYPE_USER, 'accepted' => false, 'user' => $this->uid, ]; diff --git a/apps/files_sharing/tests/GroupEtagPropagationTest.php b/apps/files_sharing/tests/GroupEtagPropagationTest.php index 5232a536259..ba688f70263 100644 --- a/apps/files_sharing/tests/GroupEtagPropagationTest.php +++ b/apps/files_sharing/tests/GroupEtagPropagationTest.php @@ -28,6 +28,7 @@ namespace OCA\Files_Sharing\Tests; use OC\Files\Filesystem; use OC\Files\View; +use OCP\Share\IShare; /** * @group SLOWDB @@ -53,7 +54,7 @@ class GroupEtagPropagationTest extends PropagationTestCase { $view1->mkdir('/test/sub'); $share = $this->share( - \OCP\Share::SHARE_TYPE_GROUP, + IShare::TYPE_GROUP, '/test', self::TEST_FILES_SHARING_API_USER1, 'group1', @@ -68,7 +69,7 @@ class GroupEtagPropagationTest extends PropagationTestCase { $view2 = new View('/' . self::TEST_FILES_SHARING_API_USER2 . '/files'); $share = $this->share( - \OCP\Share::SHARE_TYPE_GROUP, + IShare::TYPE_GROUP, '/test', self::TEST_FILES_SHARING_API_USER2, 'group2', @@ -76,7 +77,7 @@ class GroupEtagPropagationTest extends PropagationTestCase { ); $this->shareManager->acceptShare($share, self::TEST_FILES_SHARING_API_USER3); $share = $this->share( - \OCP\Share::SHARE_TYPE_GROUP, + IShare::TYPE_GROUP, '/test/sub', self::TEST_FILES_SHARING_API_USER2, 'group3', diff --git a/apps/files_sharing/tests/LockingTest.php b/apps/files_sharing/tests/LockingTest.php index c6a799f64a6..680220e5fa5 100644 --- a/apps/files_sharing/tests/LockingTest.php +++ b/apps/files_sharing/tests/LockingTest.php @@ -29,6 +29,7 @@ namespace OCA\Files_Sharing\Tests; use OC\Files\Filesystem; use OC\Files\View; use OCP\Lock\ILockingProvider; +use OCP\Share\IShare; /** * Class LockingTest @@ -63,7 +64,7 @@ class LockingTest extends TestCase { $fileId = Filesystem::getFileInfo('/foo/bar.txt')->getId(); $this->share( - \OCP\Share::SHARE_TYPE_USER, + IShare::TYPE_USER, '/foo/bar.txt', $this->ownerUid, $this->recipientUid, @@ -79,7 +80,7 @@ class LockingTest extends TestCase { parent::tearDown(); } - + public function testLockAsRecipient() { $this->expectException(\OCP\Lock\LockedException::class); diff --git a/apps/files_sharing/tests/Migration/SetPasswordColumnTest.php b/apps/files_sharing/tests/Migration/SetPasswordColumnTest.php index 0a1737ba37f..cdba86863f1 100644 --- a/apps/files_sharing/tests/Migration/SetPasswordColumnTest.php +++ b/apps/files_sharing/tests/Migration/SetPasswordColumnTest.php @@ -28,7 +28,7 @@ use OCA\Files_Sharing\Migration\SetPasswordColumn; use OCA\Files_Sharing\Tests\TestCase; use OCP\IConfig; use OCP\Migration\IOutput; -use OCP\Share; +use OCP\Share\IShare; /** * Class SetPasswordColumnTest @@ -74,7 +74,7 @@ class SetPasswordColumnTest extends TestCase { ->with('files_sharing', 'installed_version', '0.0.0') ->willReturn('1.3.0'); - $shareTypes = [Share::SHARE_TYPE_USER, Share::SHARE_TYPE_GROUP, Share::SHARE_TYPE_REMOTE, Share::SHARE_TYPE_EMAIL, Share::SHARE_TYPE_LINK]; + $shareTypes = [IShare::TYPE_USER, IShare::TYPE_GROUP, IShare::TYPE_REMOTE, IShare::TYPE_EMAIL, IShare::TYPE_LINK]; foreach ($shareTypes as $shareType) { for ($i = 0; $i < 5; $i++) { @@ -109,7 +109,7 @@ class SetPasswordColumnTest extends TestCase { $allShares = $query->execute()->fetchAll(); foreach ($allShares as $share) { - if ((int)$share['share_type'] === Share::SHARE_TYPE_LINK) { + if ((int)$share['share_type'] === IShare::TYPE_LINK) { $this->assertNull($share['share_with']); $this->assertSame('shareWith', $share['password']); } else { diff --git a/apps/files_sharing/tests/MountProviderTest.php b/apps/files_sharing/tests/MountProviderTest.php index ec52db8542e..60c622ec4a4 100644 --- a/apps/files_sharing/tests/MountProviderTest.php +++ b/apps/files_sharing/tests/MountProviderTest.php @@ -129,19 +129,19 @@ class MountProviderTest extends \Test\TestCase { ->willReturn('user1'); $this->shareManager->expects($this->at(0)) ->method('getSharedWith') - ->with('user1', \OCP\Share::SHARE_TYPE_USER) + ->with('user1', IShare::TYPE_USER) ->willReturn($userShares); $this->shareManager->expects($this->at(1)) ->method('getSharedWith') - ->with('user1', \OCP\Share::SHARE_TYPE_GROUP, null, -1) + ->with('user1', IShare::TYPE_GROUP, null, -1) ->willReturn($groupShares); $this->shareManager->expects($this->at(2)) ->method('getSharedWith') - ->with('user1', \OCP\Share::SHARE_TYPE_CIRCLE, null, -1) + ->with('user1', IShare::TYPE_CIRCLE, null, -1) ->willReturn($circleShares); $this->shareManager->expects($this->at(3)) ->method('getSharedWith') - ->with('user1', \OCP\Share::SHARE_TYPE_ROOM, null, -1) + ->with('user1', IShare::TYPE_ROOM, null, -1) ->willReturn($roomShares); $this->shareManager->expects($this->any()) ->method('newShare') @@ -338,19 +338,19 @@ class MountProviderTest extends \Test\TestCase { $roomShares = []; $this->shareManager->expects($this->at(0)) ->method('getSharedWith') - ->with('user1', \OCP\Share::SHARE_TYPE_USER) + ->with('user1', IShare::TYPE_USER) ->willReturn($userShares); $this->shareManager->expects($this->at(1)) ->method('getSharedWith') - ->with('user1', \OCP\Share::SHARE_TYPE_GROUP, null, -1) + ->with('user1', IShare::TYPE_GROUP, null, -1) ->willReturn($groupShares); $this->shareManager->expects($this->at(2)) ->method('getSharedWith') - ->with('user1', \OCP\Share::SHARE_TYPE_CIRCLE, null, -1) + ->with('user1', IShare::TYPE_CIRCLE, null, -1) ->willReturn($circleShares); $this->shareManager->expects($this->at(3)) ->method('getSharedWith') - ->with('user1', \OCP\Share::SHARE_TYPE_ROOM, null, -1) + ->with('user1', IShare::TYPE_ROOM, null, -1) ->willReturn($roomShares); $this->shareManager->expects($this->any()) ->method('newShare') diff --git a/apps/files_sharing/tests/PermissionsTest.php b/apps/files_sharing/tests/PermissionsTest.php index 30c6c2a73d2..64dad207382 100644 --- a/apps/files_sharing/tests/PermissionsTest.php +++ b/apps/files_sharing/tests/PermissionsTest.php @@ -86,7 +86,7 @@ class PermissionsTest extends TestCase { $node = $rootFolder->get('container/shareddir'); $share = $this->shareManager->newShare(); $share->setNode($node) - ->setShareType(\OCP\Share::SHARE_TYPE_USER) + ->setShareType(IShare::TYPE_USER) ->setSharedWith(self::TEST_FILES_SHARING_API_USER2) ->setSharedBy(self::TEST_FILES_SHARING_API_USER1) ->setPermissions(\OCP\Constants::PERMISSION_ALL); @@ -97,7 +97,7 @@ class PermissionsTest extends TestCase { $node = $rootFolder->get('container/shareddirrestricted'); $share = $this->shareManager->newShare(); $share->setNode($node) - ->setShareType(\OCP\Share::SHARE_TYPE_USER) + ->setShareType(IShare::TYPE_USER) ->setSharedWith(self::TEST_FILES_SHARING_API_USER2) ->setSharedBy(self::TEST_FILES_SHARING_API_USER1) ->setPermissions(\OCP\Constants::PERMISSION_READ | \OCP\Constants::PERMISSION_CREATE | \OCP\Constants::PERMISSION_UPDATE); @@ -123,7 +123,7 @@ class PermissionsTest extends TestCase { self::loginHelper(self::TEST_FILES_SHARING_API_USER1); - $shares = $this->shareManager->getSharesBy(self::TEST_FILES_SHARING_API_USER1, \OCP\Share::SHARE_TYPE_USER); + $shares = $this->shareManager->getSharesBy(self::TEST_FILES_SHARING_API_USER1, IShare::TYPE_USER); foreach ($shares as $share) { $this->shareManager->deleteShare($share); } diff --git a/apps/files_sharing/tests/ShareTest.php b/apps/files_sharing/tests/ShareTest.php index ba6b401e65e..3b695493c23 100644 --- a/apps/files_sharing/tests/ShareTest.php +++ b/apps/files_sharing/tests/ShareTest.php @@ -28,6 +28,8 @@ namespace OCA\Files_Sharing\Tests; +use OCP\Share\IShare; + /** * Class ShareTest * @@ -77,7 +79,7 @@ class ShareTest extends TestCase { $testGroup->addUser($user2); $share1 = $this->share( - \OCP\Share::SHARE_TYPE_USER, + IShare::TYPE_USER, $this->filename, self::TEST_FILES_SHARING_API_USER1, self::TEST_FILES_SHARING_API_USER2, @@ -85,7 +87,7 @@ class ShareTest extends TestCase { ); $share2 = $this->share( - \OCP\Share::SHARE_TYPE_GROUP, + IShare::TYPE_GROUP, $this->filename, self::TEST_FILES_SHARING_API_USER1, 'testGroup', @@ -131,7 +133,7 @@ class ShareTest extends TestCase { $folderinfo = $this->view->getFileInfo($this->folder); $share = $this->share( - \OCP\Share::SHARE_TYPE_USER, + IShare::TYPE_USER, $this->filename, self::TEST_FILES_SHARING_API_USER1, self::TEST_FILES_SHARING_API_USER2, @@ -141,7 +143,7 @@ class ShareTest extends TestCase { \OCA\Files_Sharing\Helper::setShareFolder('/Shared/subfolder'); $share = $this->share( - \OCP\Share::SHARE_TYPE_USER, + IShare::TYPE_USER, $this->folder, self::TEST_FILES_SHARING_API_USER1, self::TEST_FILES_SHARING_API_USER2, @@ -164,7 +166,7 @@ class ShareTest extends TestCase { \OC\Files\Filesystem::file_put_contents('test.txt', 'test'); $share = $this->share( - \OCP\Share::SHARE_TYPE_GROUP, + IShare::TYPE_GROUP, 'test.txt', self::TEST_FILES_SHARING_API_USER1, self::TEST_FILES_SHARING_API_GROUP1, @@ -173,14 +175,14 @@ class ShareTest extends TestCase { $this->loginHelper(self::TEST_FILES_SHARING_API_USER2); - $shares = $this->shareManager->getSharedWith(self::TEST_FILES_SHARING_API_USER2, \OCP\Share::SHARE_TYPE_GROUP); + $shares = $this->shareManager->getSharedWith(self::TEST_FILES_SHARING_API_USER2, IShare::TYPE_GROUP); $share = $shares[0]; $this->assertSame('/test.txt' ,$share->getTarget()); $this->assertSame(19, $share->getPermissions()); \OC\Files\Filesystem::rename('test.txt', 'new test.txt'); - $shares = $this->shareManager->getSharedWith(self::TEST_FILES_SHARING_API_USER2, \OCP\Share::SHARE_TYPE_GROUP); + $shares = $this->shareManager->getSharedWith(self::TEST_FILES_SHARING_API_USER2, IShare::TYPE_GROUP); $share = $shares[0]; $this->assertSame('/new test.txt' ,$share->getTarget()); $this->assertSame(19, $share->getPermissions()); @@ -189,7 +191,7 @@ class ShareTest extends TestCase { $this->shareManager->updateShare($share); $this->loginHelper(self::TEST_FILES_SHARING_API_USER2); - $shares = $this->shareManager->getSharedWith(self::TEST_FILES_SHARING_API_USER2, \OCP\Share::SHARE_TYPE_GROUP); + $shares = $this->shareManager->getSharedWith(self::TEST_FILES_SHARING_API_USER2, IShare::TYPE_GROUP); $share = $shares[0]; $this->assertSame('/new test.txt' ,$share->getTarget()); @@ -204,7 +206,7 @@ class ShareTest extends TestCase { $pass = true; try { $this->share( - \OCP\Share::SHARE_TYPE_USER, + IShare::TYPE_USER, $this->filename, self::TEST_FILES_SHARING_API_USER1, self::TEST_FILES_SHARING_API_USER2, @@ -235,7 +237,7 @@ class ShareTest extends TestCase { public function testFileOwner() { $this->share( - \OCP\Share::SHARE_TYPE_USER, + IShare::TYPE_USER, $this->filename, self::TEST_FILES_SHARING_API_USER1, self::TEST_FILES_SHARING_API_USER2, diff --git a/apps/files_sharing/tests/SharedMountTest.php b/apps/files_sharing/tests/SharedMountTest.php index 59c0e3b76af..c60039e321a 100644 --- a/apps/files_sharing/tests/SharedMountTest.php +++ b/apps/files_sharing/tests/SharedMountTest.php @@ -32,6 +32,7 @@ namespace OCA\Files_Sharing\Tests; use OCP\IGroupManager; use OCP\IUserManager; +use OCP\Share\IShare; /** * Class SharedMountTest @@ -84,7 +85,7 @@ class SharedMountTest extends TestCase { // share to user $share = $this->share( - \OCP\Share::SHARE_TYPE_USER, + IShare::TYPE_USER, $this->folder, self::TEST_FILES_SHARING_API_USER1, self::TEST_FILES_SHARING_API_USER2, @@ -115,7 +116,7 @@ class SharedMountTest extends TestCase { public function testDeleteParentOfMountPoint() { // share to user $share = $this->share( - \OCP\Share::SHARE_TYPE_USER, + IShare::TYPE_USER, $this->folder, self::TEST_FILES_SHARING_API_USER1, self::TEST_FILES_SHARING_API_USER2, @@ -154,7 +155,7 @@ class SharedMountTest extends TestCase { public function testMoveSharedFile() { $share = $this->share( - \OCP\Share::SHARE_TYPE_USER, + IShare::TYPE_USER, $this->filename, self::TEST_FILES_SHARING_API_USER1, self::TEST_FILES_SHARING_API_USER2, @@ -197,7 +198,7 @@ class SharedMountTest extends TestCase { $fileinfo = $this->view->getFileInfo($this->filename); $share = $this->share( - \OCP\Share::SHARE_TYPE_GROUP, + IShare::TYPE_GROUP, $this->filename, self::TEST_FILES_SHARING_API_USER1, 'testGroup', @@ -351,7 +352,7 @@ class SharedMountTest extends TestCase { // Share item with group $share = $this->share( - \OCP\Share::SHARE_TYPE_GROUP, + IShare::TYPE_GROUP, $path, self::TEST_FILES_SHARING_API_USER1, 'testGroup', @@ -415,7 +416,7 @@ class SharedMountTest extends TestCase { // Share item with group $fileinfo = $this->view->getFileInfo($this->folder); $share = $this->share( - \OCP\Share::SHARE_TYPE_GROUP, + IShare::TYPE_GROUP, $this->folder, self::TEST_FILES_SHARING_API_USER1, 'testGroup', diff --git a/apps/files_sharing/tests/SharedStorageTest.php b/apps/files_sharing/tests/SharedStorageTest.php index 7d20d98585f..fb8207a3c1d 100644 --- a/apps/files_sharing/tests/SharedStorageTest.php +++ b/apps/files_sharing/tests/SharedStorageTest.php @@ -79,7 +79,7 @@ class SharedStorageTest extends TestCase { // share to user $share = $this->share( - \OCP\Share::SHARE_TYPE_USER, + IShare::TYPE_USER, $this->folder, self::TEST_FILES_SHARING_API_USER1, self::TEST_FILES_SHARING_API_USER2, @@ -124,7 +124,7 @@ class SharedStorageTest extends TestCase { // share to user $share = $this->share( - \OCP\Share::SHARE_TYPE_USER, + IShare::TYPE_USER, $this->folder, self::TEST_FILES_SHARING_API_USER1, self::TEST_FILES_SHARING_API_USER2, @@ -164,7 +164,7 @@ class SharedStorageTest extends TestCase { $file2Size = $this->view->filesize($this->filename); $share1 = $this->share( - \OCP\Share::SHARE_TYPE_USER, + IShare::TYPE_USER, $this->folder, self::TEST_FILES_SHARING_API_USER1, self::TEST_FILES_SHARING_API_USER2, @@ -172,7 +172,7 @@ class SharedStorageTest extends TestCase { ); $share2 = $this->share( - \OCP\Share::SHARE_TYPE_USER, + IShare::TYPE_USER, $this->filename, self::TEST_FILES_SHARING_API_USER1, self::TEST_FILES_SHARING_API_USER2, @@ -194,7 +194,7 @@ class SharedStorageTest extends TestCase { public function testGetPermissions() { $share = $this->share( - \OCP\Share::SHARE_TYPE_USER, + IShare::TYPE_USER, $this->folder, self::TEST_FILES_SHARING_API_USER1, self::TEST_FILES_SHARING_API_USER2, @@ -226,7 +226,7 @@ class SharedStorageTest extends TestCase { $this->view->file_put_contents($this->folder . '/existing.txt', 'foo'); $share = $this->share( - \OCP\Share::SHARE_TYPE_USER, + IShare::TYPE_USER, $this->folder, self::TEST_FILES_SHARING_API_USER1, self::TEST_FILES_SHARING_API_USER2, @@ -259,7 +259,7 @@ class SharedStorageTest extends TestCase { $fileinfoFolder = $this->view->getFileInfo($this->folder); $share = $this->share( - \OCP\Share::SHARE_TYPE_USER, + IShare::TYPE_USER, $this->folder, self::TEST_FILES_SHARING_API_USER1, self::TEST_FILES_SHARING_API_USER2, @@ -298,7 +298,7 @@ class SharedStorageTest extends TestCase { //cleanup self::loginHelper(self::TEST_FILES_SHARING_API_USER1); - $result = \OC\Share\Share::unshare('folder', $fileinfoFolder['fileid'], \OCP\Share::SHARE_TYPE_USER, + $result = \OC\Share\Share::unshare('folder', $fileinfoFolder['fileid'], IShare::TYPE_USER, self::TEST_FILES_SHARING_API_USER2); $this->assertTrue($result); } @@ -307,7 +307,7 @@ class SharedStorageTest extends TestCase { $this->view->file_put_contents($this->folder . '/existing.txt', 'foo'); $share = $this->share( - \OCP\Share::SHARE_TYPE_USER, + IShare::TYPE_USER, $this->folder, self::TEST_FILES_SHARING_API_USER1, self::TEST_FILES_SHARING_API_USER2, @@ -353,7 +353,7 @@ class SharedStorageTest extends TestCase { $this->view->file_put_contents($this->folder . '/existing.txt', 'foo'); $share = $this->share( - \OCP\Share::SHARE_TYPE_USER, + IShare::TYPE_USER, $this->folder, self::TEST_FILES_SHARING_API_USER1, self::TEST_FILES_SHARING_API_USER2, @@ -387,14 +387,14 @@ class SharedStorageTest extends TestCase { // share 2 different files with 2 different users $share1 = $this->share( - \OCP\Share::SHARE_TYPE_USER, + IShare::TYPE_USER, $this->folder, self::TEST_FILES_SHARING_API_USER1, self::TEST_FILES_SHARING_API_USER2, \OCP\Constants::PERMISSION_ALL ); $share2 = $this->share( - \OCP\Share::SHARE_TYPE_USER, + IShare::TYPE_USER, $this->filename, self::TEST_FILES_SHARING_API_USER1, self::TEST_FILES_SHARING_API_USER3, @@ -426,7 +426,7 @@ class SharedStorageTest extends TestCase { self::loginHelper(self::TEST_FILES_SHARING_API_USER1); $share = $this->share( - \OCP\Share::SHARE_TYPE_USER, + IShare::TYPE_USER, $this->folder, self::TEST_FILES_SHARING_API_USER1, self::TEST_FILES_SHARING_API_USER2, @@ -459,7 +459,7 @@ class SharedStorageTest extends TestCase { self::loginHelper(self::TEST_FILES_SHARING_API_USER1); $share = $this->share( - \OCP\Share::SHARE_TYPE_USER, + IShare::TYPE_USER, $this->folder, self::TEST_FILES_SHARING_API_USER1, self::TEST_FILES_SHARING_API_USER2, @@ -501,7 +501,7 @@ class SharedStorageTest extends TestCase { self::loginHelper(self::TEST_FILES_SHARING_API_USER1); $share1 = $this->share( - \OCP\Share::SHARE_TYPE_GROUP, + IShare::TYPE_GROUP, 'foo', self::TEST_FILES_SHARING_API_USER1, self::TEST_FILES_SHARING_API_GROUP1, @@ -514,7 +514,7 @@ class SharedStorageTest extends TestCase { self::loginHelper(self::TEST_FILES_SHARING_API_USER3); $share2 = $this->share( - \OCP\Share::SHARE_TYPE_GROUP, + IShare::TYPE_GROUP, 'foo', self::TEST_FILES_SHARING_API_USER3, self::TEST_FILES_SHARING_API_GROUP1, @@ -543,7 +543,7 @@ class SharedStorageTest extends TestCase { self::loginHelper(self::TEST_FILES_SHARING_API_USER1); $share = $this->share( - \OCP\Share::SHARE_TYPE_USER, + IShare::TYPE_USER, $this->folder, self::TEST_FILES_SHARING_API_USER1, self::TEST_FILES_SHARING_API_USER2, diff --git a/apps/files_sharing/tests/SizePropagationTest.php b/apps/files_sharing/tests/SizePropagationTest.php index 93265f9310a..8496341e653 100644 --- a/apps/files_sharing/tests/SizePropagationTest.php +++ b/apps/files_sharing/tests/SizePropagationTest.php @@ -26,6 +26,7 @@ namespace OCA\Files_Sharing\Tests; use OC\Files\View; +use OCP\Share\IShare; use Test\Traits\UserTrait; /** @@ -54,7 +55,7 @@ class SizePropagationTest extends TestCase { $ownerView->file_put_contents('/sharedfolder/subfolder/foo.txt', 'bar'); $this->share( - \OCP\Share::SHARE_TYPE_USER, + IShare::TYPE_USER, '/sharedfolder', self::TEST_FILES_SHARING_API_USER2, self::TEST_FILES_SHARING_API_USER1, @@ -89,7 +90,7 @@ class SizePropagationTest extends TestCase { $ownerView->file_put_contents('/sharedfolder/subfolder/foo.txt', 'bar'); $this->share( - \OCP\Share::SHARE_TYPE_USER, + IShare::TYPE_USER, '/sharedfolder', self::TEST_FILES_SHARING_API_USER2, self::TEST_FILES_SHARING_API_USER1, diff --git a/apps/files_sharing/tests/UnshareChildrenTest.php b/apps/files_sharing/tests/UnshareChildrenTest.php index 3d0f13c7212..b9d06bb7fa4 100644 --- a/apps/files_sharing/tests/UnshareChildrenTest.php +++ b/apps/files_sharing/tests/UnshareChildrenTest.php @@ -28,6 +28,8 @@ namespace OCA\Files_Sharing\Tests; +use OCP\Share\IShare; + /** * Class UnshareChildrenTest * @@ -78,7 +80,7 @@ class UnshareChildrenTest extends TestCase { $fileInfo2 = \OC\Files\Filesystem::getFileInfo($this->folder); $this->share( - \OCP\Share::SHARE_TYPE_USER, + IShare::TYPE_USER, $this->folder, self::TEST_FILES_SHARING_API_USER1, self::TEST_FILES_SHARING_API_USER2, @@ -88,7 +90,7 @@ class UnshareChildrenTest extends TestCase { self::loginHelper(self::TEST_FILES_SHARING_API_USER2); // one folder should be shared with the user - $shares = $this->shareManager->getSharedWith(self::TEST_FILES_SHARING_API_USER2, \OCP\Share::SHARE_TYPE_USER); + $shares = $this->shareManager->getSharedWith(self::TEST_FILES_SHARING_API_USER2, IShare::TYPE_USER); $this->assertCount(1, $shares); // move shared folder to 'localDir' @@ -101,7 +103,7 @@ class UnshareChildrenTest extends TestCase { self::loginHelper(self::TEST_FILES_SHARING_API_USER2); // after the parent directory was deleted the share should be unshared - $shares = $this->shareManager->getSharedWith(self::TEST_FILES_SHARING_API_USER2, \OCP\Share::SHARE_TYPE_USER); + $shares = $this->shareManager->getSharedWith(self::TEST_FILES_SHARING_API_USER2, IShare::TYPE_USER); $this->assertEmpty($shares); self::loginHelper(self::TEST_FILES_SHARING_API_USER1); diff --git a/apps/files_sharing/tests/UpdaterTest.php b/apps/files_sharing/tests/UpdaterTest.php index 7f6f3172fcc..30efbac533d 100644 --- a/apps/files_sharing/tests/UpdaterTest.php +++ b/apps/files_sharing/tests/UpdaterTest.php @@ -31,6 +31,8 @@ namespace OCA\Files_Sharing\Tests; +use OCP\Share\IShare; + /** * Class UpdaterTest * @@ -82,7 +84,7 @@ class UpdaterTest extends TestCase { $this->assertTrue($fileinfo instanceof \OC\Files\FileInfo); $this->share( - \OCP\Share::SHARE_TYPE_USER, + IShare::TYPE_USER, $this->folder, self::TEST_FILES_SHARING_API_USER1, self::TEST_FILES_SHARING_API_USER2, @@ -166,7 +168,7 @@ class UpdaterTest extends TestCase { $this->loginHelper(self::TEST_FILES_SHARING_API_USER1); $share = $this->share( - \OCP\Share::SHARE_TYPE_USER, + IShare::TYPE_USER, $this->folder, self::TEST_FILES_SHARING_API_USER1, self::TEST_FILES_SHARING_API_USER2, @@ -202,7 +204,7 @@ class UpdaterTest extends TestCase { $fileinfo = \OC\Files\Filesystem::getFileInfo($this->folder); $share = $this->share( - \OCP\Share::SHARE_TYPE_USER, + IShare::TYPE_USER, $this->folder, self::TEST_FILES_SHARING_API_USER1, self::TEST_FILES_SHARING_API_USER2, diff --git a/apps/files_sharing/tests/WatcherTest.php b/apps/files_sharing/tests/WatcherTest.php index e105bf16161..fc255753060 100644 --- a/apps/files_sharing/tests/WatcherTest.php +++ b/apps/files_sharing/tests/WatcherTest.php @@ -70,7 +70,7 @@ class WatcherTest extends TestCase { // share "shareddir" with user2 $this->_share = $this->share( - \OCP\Share::SHARE_TYPE_USER, + IShare::TYPE_USER, 'container/shareddir', self::TEST_FILES_SHARING_API_USER1, self::TEST_FILES_SHARING_API_USER2, |