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 /tests/lib/Share20 | |
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 'tests/lib/Share20')
-rw-r--r-- | tests/lib/Share20/DefaultShareProviderTest.php | 244 | ||||
-rw-r--r-- | tests/lib/Share20/LegacyHooksTest.php | 29 | ||||
-rw-r--r-- | tests/lib/Share20/ManagerTest.php | 246 |
3 files changed, 260 insertions, 259 deletions
diff --git a/tests/lib/Share20/DefaultShareProviderTest.php b/tests/lib/Share20/DefaultShareProviderTest.php index cb332ac186a..b3de9d05a52 100644 --- a/tests/lib/Share20/DefaultShareProviderTest.php +++ b/tests/lib/Share20/DefaultShareProviderTest.php @@ -189,7 +189,7 @@ class DefaultShareProviderTest extends \Test\TestCase { $qb->insert('share') ->values([ - 'share_type' => $qb->expr()->literal(\OCP\Share::SHARE_TYPE_USER), + 'share_type' => $qb->expr()->literal(IShare::TYPE_USER), 'share_with' => $qb->expr()->literal('sharedWith'), 'uid_owner' => $qb->expr()->literal('shareOwner'), 'uid_initiator' => $qb->expr()->literal('sharedBy'), @@ -220,7 +220,7 @@ class DefaultShareProviderTest extends \Test\TestCase { $share = $this->provider->getShareById($id); $this->assertEquals($id, $share->getId()); - $this->assertEquals(\OCP\Share::SHARE_TYPE_USER, $share->getShareType()); + $this->assertEquals(IShare::TYPE_USER, $share->getShareType()); $this->assertEquals('sharedWith', $share->getSharedWith()); $this->assertEquals('sharedBy', $share->getSharedBy()); $this->assertEquals('shareOwner', $share->getShareOwner()); @@ -236,7 +236,7 @@ class DefaultShareProviderTest extends \Test\TestCase { $qb->insert('share') ->values([ - 'share_type' => $qb->expr()->literal(\OCP\Share::SHARE_TYPE_USER), + 'share_type' => $qb->expr()->literal(IShare::TYPE_USER), 'share_with' => $qb->expr()->literal('sharedWith'), 'uid_owner' => $qb->expr()->literal('shareOwner'), 'uid_initiator' => $qb->expr()->literal('sharedBy'), @@ -256,7 +256,7 @@ class DefaultShareProviderTest extends \Test\TestCase { // We do not fetch the node so the rootfolder is never called. $this->assertEquals($id, $share->getId()); - $this->assertEquals(\OCP\Share::SHARE_TYPE_USER, $share->getShareType()); + $this->assertEquals(IShare::TYPE_USER, $share->getShareType()); $this->assertEquals('sharedWith', $share->getSharedWith()); $this->assertEquals('sharedBy', $share->getSharedBy()); $this->assertEquals('shareOwner', $share->getShareOwner()); @@ -271,7 +271,7 @@ class DefaultShareProviderTest extends \Test\TestCase { $qb->insert('share') ->values([ - 'share_type' => $qb->expr()->literal(\OCP\Share::SHARE_TYPE_USER), + 'share_type' => $qb->expr()->literal(IShare::TYPE_USER), 'share_with' => $qb->expr()->literal('sharedWith'), 'uid_owner' => $qb->expr()->literal('shareOwner'), 'uid_initiator' => $qb->expr()->literal('sharedBy'), @@ -299,7 +299,7 @@ class DefaultShareProviderTest extends \Test\TestCase { // We fetch the node so the root folder is eventually called $this->assertEquals($id, $share->getId()); - $this->assertEquals(\OCP\Share::SHARE_TYPE_USER, $share->getShareType()); + $this->assertEquals(IShare::TYPE_USER, $share->getShareType()); $this->assertEquals('sharedWith', $share->getSharedWith()); $this->assertEquals('sharedBy', $share->getSharedBy()); $this->assertEquals('shareOwner', $share->getShareOwner()); @@ -315,7 +315,7 @@ class DefaultShareProviderTest extends \Test\TestCase { $qb->insert('share') ->values([ - 'share_type' => $qb->expr()->literal(\OCP\Share::SHARE_TYPE_GROUP), + 'share_type' => $qb->expr()->literal(IShare::TYPE_GROUP), 'share_with' => $qb->expr()->literal('sharedWith'), 'uid_owner' => $qb->expr()->literal('shareOwner'), 'uid_initiator' => $qb->expr()->literal('sharedBy'), @@ -342,7 +342,7 @@ class DefaultShareProviderTest extends \Test\TestCase { $share = $this->provider->getShareById($id); $this->assertEquals($id, $share->getId()); - $this->assertEquals(\OCP\Share::SHARE_TYPE_GROUP, $share->getShareType()); + $this->assertEquals(IShare::TYPE_GROUP, $share->getShareType()); $this->assertEquals('sharedWith', $share->getSharedWith()); $this->assertEquals('sharedBy', $share->getSharedBy()); $this->assertEquals('shareOwner', $share->getShareOwner()); @@ -354,7 +354,7 @@ class DefaultShareProviderTest extends \Test\TestCase { } public function testGetShareByIdUserGroupShare() { - $id = $this->addShareToDB(\OCP\Share::SHARE_TYPE_GROUP, 'group0', 'user0', 'user0', 'file', 42, 'myTarget', 31, null, null); + $id = $this->addShareToDB(IShare::TYPE_GROUP, 'group0', 'user0', 'user0', 'file', 42, 'myTarget', 31, null, null); $this->addShareToDB(2, 'user1', 'user0', 'user0', 'file', 42, 'userTarget', 0, null, null, $id); $user0 = $this->createMock(IUser::class); @@ -380,7 +380,7 @@ class DefaultShareProviderTest extends \Test\TestCase { $share = $this->provider->getShareById($id, 'user1'); $this->assertEquals($id, $share->getId()); - $this->assertEquals(\OCP\Share::SHARE_TYPE_GROUP, $share->getShareType()); + $this->assertEquals(IShare::TYPE_GROUP, $share->getShareType()); $this->assertSame('group0', $share->getSharedWith()); $this->assertSame('user0', $share->getSharedBy()); $this->assertSame('user0', $share->getShareOwner()); @@ -396,7 +396,7 @@ class DefaultShareProviderTest extends \Test\TestCase { $qb->insert('share') ->values([ - 'share_type' => $qb->expr()->literal(\OCP\Share::SHARE_TYPE_LINK), + 'share_type' => $qb->expr()->literal(IShare::TYPE_LINK), 'password' => $qb->expr()->literal('password'), 'password_by_talk' => $qb->expr()->literal(true), 'uid_owner' => $qb->expr()->literal('shareOwner'), @@ -425,7 +425,7 @@ class DefaultShareProviderTest extends \Test\TestCase { $share = $this->provider->getShareById($id); $this->assertEquals($id, $share->getId()); - $this->assertEquals(\OCP\Share::SHARE_TYPE_LINK, $share->getShareType()); + $this->assertEquals(IShare::TYPE_LINK, $share->getShareType()); $this->assertNull($share->getSharedWith()); $this->assertEquals('password', $share->getPassword()); $this->assertEquals(true, $share->getSendPasswordByTalk()); @@ -442,7 +442,7 @@ class DefaultShareProviderTest extends \Test\TestCase { $qb = $this->dbConn->getQueryBuilder(); $qb->insert('share') ->values([ - 'share_type' => $qb->expr()->literal(\OCP\Share::SHARE_TYPE_USER), + 'share_type' => $qb->expr()->literal(IShare::TYPE_USER), 'share_with' => $qb->expr()->literal('sharedWith'), 'uid_owner' => $qb->expr()->literal('sharedBy'), 'item_type' => $qb->expr()->literal('file'), @@ -490,7 +490,7 @@ class DefaultShareProviderTest extends \Test\TestCase { $qb = $this->dbConn->getQueryBuilder(); $qb->insert('share') ->values([ - 'share_type' => $qb->expr()->literal(\OCP\Share::SHARE_TYPE_USER), + 'share_type' => $qb->expr()->literal(IShare::TYPE_USER), 'share_with' => $qb->expr()->literal('sharedWith'), 'uid_owner' => $qb->expr()->literal('shareOwner'), 'uid_initiator' => $qb->expr()->literal('sharedBy'), @@ -523,7 +523,7 @@ class DefaultShareProviderTest extends \Test\TestCase { $qb = $this->dbConn->getQueryBuilder(); $qb->insert('share') ->values([ - 'share_type' => $qb->expr()->literal(\OCP\Share::SHARE_TYPE_GROUP), + 'share_type' => $qb->expr()->literal(IShare::TYPE_GROUP), 'share_with' => $qb->expr()->literal('sharedWith'), 'uid_owner' => $qb->expr()->literal('sharedBy'), 'item_type' => $qb->expr()->literal('file'), @@ -550,7 +550,7 @@ class DefaultShareProviderTest extends \Test\TestCase { $share = $this->createMock(IShare::class); $share->method('getId')->willReturn($id); - $share->method('getShareType')->willReturn(\OCP\Share::SHARE_TYPE_GROUP); + $share->method('getShareType')->willReturn(IShare::TYPE_GROUP); /** @var DefaultShareProvider $provider */ $provider = $this->getMockBuilder(DefaultShareProvider::class) @@ -585,7 +585,7 @@ class DefaultShareProviderTest extends \Test\TestCase { $qb = $this->dbConn->getQueryBuilder(); $qb->insert('share') ->values([ - 'share_type' => $qb->expr()->literal(\OCP\Share::SHARE_TYPE_USER), + 'share_type' => $qb->expr()->literal(IShare::TYPE_USER), 'share_with' => $qb->expr()->literal('sharedWith'), 'uid_owner' => $qb->expr()->literal('shareOwner'), 'uid_initiator' => $qb->expr()->literal('sharedBy'), @@ -602,7 +602,7 @@ class DefaultShareProviderTest extends \Test\TestCase { $qb = $this->dbConn->getQueryBuilder(); $qb->insert('share') ->values([ - 'share_type' => $qb->expr()->literal(\OCP\Share::SHARE_TYPE_USER), + 'share_type' => $qb->expr()->literal(IShare::TYPE_USER), 'share_with' => $qb->expr()->literal('user1'), 'uid_owner' => $qb->expr()->literal('shareOwner'), 'uid_initiator' => $qb->expr()->literal('user2'), @@ -617,7 +617,7 @@ class DefaultShareProviderTest extends \Test\TestCase { $qb = $this->dbConn->getQueryBuilder(); $qb->insert('share') ->values([ - 'share_type' => $qb->expr()->literal(\OCP\Share::SHARE_TYPE_GROUP), + 'share_type' => $qb->expr()->literal(IShare::TYPE_GROUP), 'share_with' => $qb->expr()->literal('group1'), 'uid_owner' => $qb->expr()->literal('shareOwner'), 'uid_initiator' => $qb->expr()->literal('user3'), @@ -647,7 +647,7 @@ class DefaultShareProviderTest extends \Test\TestCase { $this->assertCount(2, $children); //Child1 - $this->assertEquals(\OCP\Share::SHARE_TYPE_USER, $children[0]->getShareType()); + $this->assertEquals(IShare::TYPE_USER, $children[0]->getShareType()); $this->assertEquals('user1', $children[0]->getSharedWith()); $this->assertEquals('user2', $children[0]->getSharedBy()); $this->assertEquals('shareOwner', $children[0]->getShareOwner()); @@ -658,7 +658,7 @@ class DefaultShareProviderTest extends \Test\TestCase { $this->assertEquals('myTarget1', $children[0]->getTarget()); //Child2 - $this->assertEquals(\OCP\Share::SHARE_TYPE_GROUP, $children[1]->getShareType()); + $this->assertEquals(IShare::TYPE_GROUP, $children[1]->getShareType()); $this->assertEquals('group1', $children[1]->getSharedWith()); $this->assertEquals('user3', $children[1]->getSharedBy()); $this->assertEquals('shareOwner', $children[1]->getShareOwner()); @@ -695,7 +695,7 @@ class DefaultShareProviderTest extends \Test\TestCase { ->with(100) ->willReturn([$path]); - $share->setShareType(\OCP\Share::SHARE_TYPE_USER); + $share->setShareType(IShare::TYPE_USER); $share->setSharedWith('sharedWith'); $share->setSharedBy('sharedBy'); $share->setShareOwner('shareOwner'); @@ -709,7 +709,7 @@ class DefaultShareProviderTest extends \Test\TestCase { $this->assertNotNull($share2->getId()); $this->assertSame('ocinternal:'.$share2->getId(), $share2->getFullId()); - $this->assertSame(\OCP\Share::SHARE_TYPE_USER, $share2->getShareType()); + $this->assertSame(IShare::TYPE_USER, $share2->getShareType()); $this->assertSame('sharedWith', $share2->getSharedWith()); $this->assertSame('sharedBy', $share2->getSharedBy()); $this->assertSame('shareOwner', $share2->getShareOwner()); @@ -751,7 +751,7 @@ class DefaultShareProviderTest extends \Test\TestCase { ->with(100) ->willReturn([$path]); - $share->setShareType(\OCP\Share::SHARE_TYPE_GROUP); + $share->setShareType(IShare::TYPE_GROUP); $share->setSharedWith('sharedWith'); $share->setSharedBy('sharedBy'); $share->setShareOwner('shareOwner'); @@ -765,7 +765,7 @@ class DefaultShareProviderTest extends \Test\TestCase { $this->assertNotNull($share2->getId()); $this->assertSame('ocinternal:'.$share2->getId(), $share2->getFullId()); - $this->assertSame(\OCP\Share::SHARE_TYPE_GROUP, $share2->getShareType()); + $this->assertSame(IShare::TYPE_GROUP, $share2->getShareType()); $this->assertSame('sharedWith', $share2->getSharedWith()); $this->assertSame('sharedBy', $share2->getSharedBy()); $this->assertSame('shareOwner', $share2->getShareOwner()); @@ -807,7 +807,7 @@ class DefaultShareProviderTest extends \Test\TestCase { ->with(100) ->willReturn([$path]); - $share->setShareType(\OCP\Share::SHARE_TYPE_LINK); + $share->setShareType(IShare::TYPE_LINK); $share->setSharedBy('sharedBy'); $share->setShareOwner('shareOwner'); $share->setNode($path); @@ -823,7 +823,7 @@ class DefaultShareProviderTest extends \Test\TestCase { $this->assertNotNull($share2->getId()); $this->assertSame('ocinternal:'.$share2->getId(), $share2->getFullId()); - $this->assertSame(\OCP\Share::SHARE_TYPE_LINK, $share2->getShareType()); + $this->assertSame(IShare::TYPE_LINK, $share2->getShareType()); $this->assertSame('sharedBy', $share2->getSharedBy()); $this->assertSame('shareOwner', $share2->getShareOwner()); $this->assertSame(1, $share2->getPermissions()); @@ -841,7 +841,7 @@ class DefaultShareProviderTest extends \Test\TestCase { $qb->insert('share') ->values([ - 'share_type' => $qb->expr()->literal(\OCP\Share::SHARE_TYPE_LINK), + 'share_type' => $qb->expr()->literal(IShare::TYPE_LINK), 'password' => $qb->expr()->literal('password'), 'password_by_talk' => $qb->expr()->literal(true), 'uid_owner' => $qb->expr()->literal('shareOwner'), @@ -921,7 +921,7 @@ class DefaultShareProviderTest extends \Test\TestCase { $qb = $this->dbConn->getQueryBuilder(); $qb->insert('share') ->values([ - 'share_type' => $qb->expr()->literal(\OCP\Share::SHARE_TYPE_USER), + 'share_type' => $qb->expr()->literal(IShare::TYPE_USER), 'share_with' => $qb->expr()->literal('sharedWith'), 'uid_owner' => $qb->expr()->literal('shareOwner'), 'uid_initiator' => $qb->expr()->literal('sharedBy'), @@ -936,7 +936,7 @@ class DefaultShareProviderTest extends \Test\TestCase { $qb = $this->dbConn->getQueryBuilder(); $qb->insert('share') ->values([ - 'share_type' => $qb->expr()->literal(\OCP\Share::SHARE_TYPE_USER), + 'share_type' => $qb->expr()->literal(IShare::TYPE_USER), 'share_with' => $qb->expr()->literal('sharedWith2'), 'uid_owner' => $qb->expr()->literal('shareOwner2'), 'uid_initiator' => $qb->expr()->literal('sharedBy2'), @@ -951,7 +951,7 @@ class DefaultShareProviderTest extends \Test\TestCase { $this->rootFolder->method('getUserFolder')->with('shareOwner')->willReturnSelf(); $this->rootFolder->method('getById')->with($fileId)->willReturn([$file]); - $share = $this->provider->getSharedWith('sharedWith', \OCP\Share::SHARE_TYPE_USER, null, 1 , 0); + $share = $this->provider->getSharedWith('sharedWith', IShare::TYPE_USER, null, 1 , 0); $this->assertCount(1, $share); $share = $share[0]; @@ -959,7 +959,7 @@ class DefaultShareProviderTest extends \Test\TestCase { $this->assertEquals('sharedWith', $share->getSharedWith()); $this->assertEquals('shareOwner', $share->getShareOwner()); $this->assertEquals('sharedBy', $share->getSharedBy()); - $this->assertEquals(\OCP\Share::SHARE_TYPE_USER, $share->getShareType()); + $this->assertEquals(IShare::TYPE_USER, $share->getShareType()); } /** @@ -972,7 +972,7 @@ class DefaultShareProviderTest extends \Test\TestCase { $qb = $this->dbConn->getQueryBuilder(); $qb->insert('share') ->values([ - 'share_type' => $qb->expr()->literal(\OCP\Share::SHARE_TYPE_GROUP), + 'share_type' => $qb->expr()->literal(IShare::TYPE_GROUP), 'share_with' => $qb->expr()->literal('sharedWith'), 'uid_owner' => $qb->expr()->literal('shareOwner2'), 'uid_initiator' => $qb->expr()->literal('sharedBy2'), @@ -986,7 +986,7 @@ class DefaultShareProviderTest extends \Test\TestCase { $qb = $this->dbConn->getQueryBuilder(); $qb->insert('share') ->values([ - 'share_type' => $qb->expr()->literal(\OCP\Share::SHARE_TYPE_GROUP), + 'share_type' => $qb->expr()->literal(IShare::TYPE_GROUP), 'share_with' => $qb->expr()->literal('sharedWith'), 'uid_owner' => $qb->expr()->literal('shareOwner'), 'uid_initiator' => $qb->expr()->literal('sharedBy'), @@ -1023,7 +1023,7 @@ class DefaultShareProviderTest extends \Test\TestCase { $this->rootFolder->method('getUserFolder')->with('shareOwner')->willReturnSelf(); $this->rootFolder->method('getById')->with($fileId)->willReturn([$file]); - $share = $this->provider->getSharedWith('sharedWith', \OCP\Share::SHARE_TYPE_GROUP, null, 20 , 1); + $share = $this->provider->getSharedWith('sharedWith', IShare::TYPE_GROUP, null, 20 , 1); $this->assertCount(1, $share); $share = $share[0]; @@ -1031,7 +1031,7 @@ class DefaultShareProviderTest extends \Test\TestCase { $this->assertEquals('sharedWith', $share->getSharedWith()); $this->assertEquals('shareOwner', $share->getShareOwner()); $this->assertEquals('sharedBy', $share->getSharedBy()); - $this->assertEquals(\OCP\Share::SHARE_TYPE_GROUP, $share->getShareType()); + $this->assertEquals(IShare::TYPE_GROUP, $share->getShareType()); } /** @@ -1043,7 +1043,7 @@ class DefaultShareProviderTest extends \Test\TestCase { $qb = $this->dbConn->getQueryBuilder(); $qb->insert('share') ->values([ - 'share_type' => $qb->expr()->literal(\OCP\Share::SHARE_TYPE_GROUP), + 'share_type' => $qb->expr()->literal(IShare::TYPE_GROUP), 'share_with' => $qb->expr()->literal('sharedWith'), 'uid_owner' => $qb->expr()->literal('shareOwner'), 'uid_initiator' => $qb->expr()->literal('sharedBy'), @@ -1111,7 +1111,7 @@ class DefaultShareProviderTest extends \Test\TestCase { $this->rootFolder->method('getUserFolder')->with('shareOwner')->willReturnSelf(); $this->rootFolder->method('getById')->with($fileId)->willReturn([$file]); - $share = $this->provider->getSharedWith('user', \OCP\Share::SHARE_TYPE_GROUP, null, -1, 0); + $share = $this->provider->getSharedWith('user', IShare::TYPE_GROUP, null, -1, 0); $this->assertCount(1, $share); $share = $share[0]; @@ -1119,7 +1119,7 @@ class DefaultShareProviderTest extends \Test\TestCase { $this->assertSame('sharedWith', $share->getSharedWith()); $this->assertSame('shareOwner', $share->getShareOwner()); $this->assertSame('sharedBy', $share->getSharedBy()); - $this->assertSame(\OCP\Share::SHARE_TYPE_GROUP, $share->getShareType()); + $this->assertSame(IShare::TYPE_GROUP, $share->getShareType()); $this->assertSame(0, $share->getPermissions()); $this->assertSame('userTarget', $share->getTarget()); } @@ -1131,9 +1131,9 @@ class DefaultShareProviderTest extends \Test\TestCase { $storageId = $this->createTestStorageEntry($storageStringId); $fileId = $this->createTestFileEntry($fileName1, $storageId); $fileId2 = $this->createTestFileEntry($fileName2, $storageId); - $this->addShareToDB(\OCP\Share::SHARE_TYPE_USER, 'user0', 'user1', 'user1', + $this->addShareToDB(IShare::TYPE_USER, 'user0', 'user1', 'user1', 'file', $fileId, 'myTarget', 31, null, null, null); - $id = $this->addShareToDB(\OCP\Share::SHARE_TYPE_USER, 'user0', 'user1', 'user1', + $id = $this->addShareToDB(IShare::TYPE_USER, 'user0', 'user1', 'user1', 'file', $fileId2, 'myTarget', 31, null, null, null); $user0 = $this->createMock(IUser::class); @@ -1154,7 +1154,7 @@ class DefaultShareProviderTest extends \Test\TestCase { $this->rootFolder->method('getUserFolder')->with('user1')->willReturnSelf(); $this->rootFolder->method('getById')->with($fileId2)->willReturn([$file]); - $share = $this->provider->getSharedWith('user0', \OCP\Share::SHARE_TYPE_USER, $file, -1, 0); + $share = $this->provider->getSharedWith('user0', IShare::TYPE_USER, $file, -1, 0); $this->assertCount(1, $share); $share = $share[0]; @@ -1163,7 +1163,7 @@ class DefaultShareProviderTest extends \Test\TestCase { $this->assertSame('user1', $share->getShareOwner()); $this->assertSame('user1', $share->getSharedBy()); $this->assertSame($file, $share->getNode()); - $this->assertEquals(\OCP\Share::SHARE_TYPE_USER, $share->getShareType()); + $this->assertEquals(IShare::TYPE_USER, $share->getShareType()); } /** @@ -1173,9 +1173,9 @@ class DefaultShareProviderTest extends \Test\TestCase { $storageId = $this->createTestStorageEntry($storageStringId); $fileId = $this->createTestFileEntry($fileName1, $storageId); $fileId2 = $this->createTestFileEntry($fileName2, $storageId); - $this->addShareToDB(\OCP\Share::SHARE_TYPE_GROUP, 'group0', 'user1', 'user1', + $this->addShareToDB(IShare::TYPE_GROUP, 'group0', 'user1', 'user1', 'file', $fileId, 'myTarget', 31, null, null, null); - $id = $this->addShareToDB(\OCP\Share::SHARE_TYPE_GROUP, 'group0', 'user1', 'user1', + $id = $this->addShareToDB(IShare::TYPE_GROUP, 'group0', 'user1', 'user1', 'file', $fileId2, 'myTarget', 31, null, null, null); $user0 = $this->createMock(IUser::class); @@ -1195,7 +1195,7 @@ class DefaultShareProviderTest extends \Test\TestCase { $this->rootFolder->method('getUserFolder')->with('user1')->willReturnSelf(); $this->rootFolder->method('getById')->with($fileId2)->willReturn([$node]); - $share = $this->provider->getSharedWith('user0', \OCP\Share::SHARE_TYPE_GROUP, $node, -1, 0); + $share = $this->provider->getSharedWith('user0', IShare::TYPE_GROUP, $node, -1, 0); $this->assertCount(1, $share); $share = $share[0]; @@ -1204,15 +1204,15 @@ class DefaultShareProviderTest extends \Test\TestCase { $this->assertSame('user1', $share->getShareOwner()); $this->assertSame('user1', $share->getSharedBy()); $this->assertSame($node, $share->getNode()); - $this->assertEquals(\OCP\Share::SHARE_TYPE_GROUP, $share->getShareType()); + $this->assertEquals(IShare::TYPE_GROUP, $share->getShareType()); } public function shareTypesProvider() { return [ - [\OCP\Share::SHARE_TYPE_USER, false], - [\OCP\Share::SHARE_TYPE_GROUP, false], - [\OCP\Share::SHARE_TYPE_USER, true], - [\OCP\Share::SHARE_TYPE_GROUP, true], + [IShare::TYPE_USER, false], + [IShare::TYPE_GROUP, false], + [IShare::TYPE_USER, true], + [IShare::TYPE_GROUP, true], ]; } @@ -1275,7 +1275,7 @@ class DefaultShareProviderTest extends \Test\TestCase { $qb = $this->dbConn->getQueryBuilder(); $qb->insert('share') ->values([ - 'share_type' => $qb->expr()->literal(\OCP\Share::SHARE_TYPE_USER), + 'share_type' => $qb->expr()->literal(IShare::TYPE_USER), 'share_with' => $qb->expr()->literal('sharedWith'), 'uid_owner' => $qb->expr()->literal('shareOwner'), 'uid_initiator' => $qb->expr()->literal('sharedBy'), @@ -1290,7 +1290,7 @@ class DefaultShareProviderTest extends \Test\TestCase { $qb = $this->dbConn->getQueryBuilder(); $qb->insert('share') ->values([ - 'share_type' => $qb->expr()->literal(\OCP\Share::SHARE_TYPE_USER), + 'share_type' => $qb->expr()->literal(IShare::TYPE_USER), 'share_with' => $qb->expr()->literal('sharedWith'), 'uid_owner' => $qb->expr()->literal('shareOwner'), 'uid_initiator' => $qb->expr()->literal('sharedBy2'), @@ -1306,7 +1306,7 @@ class DefaultShareProviderTest extends \Test\TestCase { $this->rootFolder->method('getUserFolder')->with('shareOwner')->willReturnSelf(); $this->rootFolder->method('getById')->with(42)->willReturn([$file]); - $share = $this->provider->getSharesBy('sharedBy', \OCP\Share::SHARE_TYPE_USER, null, false, 1, 0); + $share = $this->provider->getSharesBy('sharedBy', IShare::TYPE_USER, null, false, 1, 0); $this->assertCount(1, $share); /** @var IShare $share */ @@ -1315,7 +1315,7 @@ class DefaultShareProviderTest extends \Test\TestCase { $this->assertEquals('sharedWith', $share->getSharedWith()); $this->assertEquals('shareOwner', $share->getShareOwner()); $this->assertEquals('sharedBy', $share->getSharedBy()); - $this->assertEquals(\OCP\Share::SHARE_TYPE_USER, $share->getShareType()); + $this->assertEquals(IShare::TYPE_USER, $share->getShareType()); $this->assertEquals(13, $share->getPermissions()); $this->assertEquals('myTarget', $share->getTarget()); } @@ -1324,7 +1324,7 @@ class DefaultShareProviderTest extends \Test\TestCase { $qb = $this->dbConn->getQueryBuilder(); $qb->insert('share') ->values([ - 'share_type' => $qb->expr()->literal(\OCP\Share::SHARE_TYPE_USER), + 'share_type' => $qb->expr()->literal(IShare::TYPE_USER), 'share_with' => $qb->expr()->literal('sharedWith'), 'uid_owner' => $qb->expr()->literal('shareOwner'), 'uid_initiator' => $qb->expr()->literal('sharedBy'), @@ -1339,7 +1339,7 @@ class DefaultShareProviderTest extends \Test\TestCase { $qb = $this->dbConn->getQueryBuilder(); $qb->insert('share') ->values([ - 'share_type' => $qb->expr()->literal(\OCP\Share::SHARE_TYPE_USER), + 'share_type' => $qb->expr()->literal(IShare::TYPE_USER), 'share_with' => $qb->expr()->literal('sharedWith'), 'uid_owner' => $qb->expr()->literal('shareOwner'), 'uid_initiator' => $qb->expr()->literal('sharedBy'), @@ -1356,7 +1356,7 @@ class DefaultShareProviderTest extends \Test\TestCase { $this->rootFolder->method('getUserFolder')->with('shareOwner')->willReturnSelf(); $this->rootFolder->method('getById')->with(42)->willReturn([$file]); - $share = $this->provider->getSharesBy('sharedBy', \OCP\Share::SHARE_TYPE_USER, $file, false, 1, 0); + $share = $this->provider->getSharesBy('sharedBy', IShare::TYPE_USER, $file, false, 1, 0); $this->assertCount(1, $share); /** @var IShare $share */ @@ -1365,7 +1365,7 @@ class DefaultShareProviderTest extends \Test\TestCase { $this->assertEquals('sharedWith', $share->getSharedWith()); $this->assertEquals('shareOwner', $share->getShareOwner()); $this->assertEquals('sharedBy', $share->getSharedBy()); - $this->assertEquals(\OCP\Share::SHARE_TYPE_USER, $share->getShareType()); + $this->assertEquals(IShare::TYPE_USER, $share->getShareType()); $this->assertEquals(13, $share->getPermissions()); $this->assertEquals('myTarget', $share->getTarget()); } @@ -1374,7 +1374,7 @@ class DefaultShareProviderTest extends \Test\TestCase { $qb = $this->dbConn->getQueryBuilder(); $qb->insert('share') ->values([ - 'share_type' => $qb->expr()->literal(\OCP\Share::SHARE_TYPE_USER), + 'share_type' => $qb->expr()->literal(IShare::TYPE_USER), 'share_with' => $qb->expr()->literal('sharedWith'), 'uid_owner' => $qb->expr()->literal('shareOwner'), 'uid_initiator' => $qb->expr()->literal('shareOwner'), @@ -1389,7 +1389,7 @@ class DefaultShareProviderTest extends \Test\TestCase { $qb = $this->dbConn->getQueryBuilder(); $qb->insert('share') ->values([ - 'share_type' => $qb->expr()->literal(\OCP\Share::SHARE_TYPE_USER), + 'share_type' => $qb->expr()->literal(IShare::TYPE_USER), 'share_with' => $qb->expr()->literal('sharedWith'), 'uid_owner' => $qb->expr()->literal('shareOwner'), 'uid_initiator' => $qb->expr()->literal('sharedBy'), @@ -1406,7 +1406,7 @@ class DefaultShareProviderTest extends \Test\TestCase { $this->rootFolder->method('getUserFolder')->with('shareOwner')->willReturnSelf(); $this->rootFolder->method('getById')->with(42)->willReturn([$file]); - $shares = $this->provider->getSharesBy('shareOwner', \OCP\Share::SHARE_TYPE_USER, null, true, -1, 0); + $shares = $this->provider->getSharesBy('shareOwner', IShare::TYPE_USER, null, true, -1, 0); $this->assertCount(2, $shares); /** @var IShare $share */ @@ -1415,7 +1415,7 @@ class DefaultShareProviderTest extends \Test\TestCase { $this->assertSame('sharedWith', $share->getSharedWith()); $this->assertSame('shareOwner', $share->getShareOwner()); $this->assertSame('shareOwner', $share->getSharedBy()); - $this->assertEquals(\OCP\Share::SHARE_TYPE_USER, $share->getShareType()); + $this->assertEquals(IShare::TYPE_USER, $share->getShareType()); $this->assertEquals(13, $share->getPermissions()); $this->assertEquals('myTarget', $share->getTarget()); @@ -1424,7 +1424,7 @@ class DefaultShareProviderTest extends \Test\TestCase { $this->assertSame('sharedWith', $share->getSharedWith()); $this->assertSame('shareOwner', $share->getShareOwner()); $this->assertSame('sharedBy', $share->getSharedBy()); - $this->assertEquals(\OCP\Share::SHARE_TYPE_USER, $share->getShareType()); + $this->assertEquals(IShare::TYPE_USER, $share->getShareType()); $this->assertEquals(0, $share->getPermissions()); $this->assertEquals('userTarget', $share->getTarget()); } @@ -1433,7 +1433,7 @@ class DefaultShareProviderTest extends \Test\TestCase { $qb = $this->dbConn->getQueryBuilder(); $stmt = $qb->insert('share') ->values([ - 'share_type' => $qb->expr()->literal(\OCP\Share::SHARE_TYPE_GROUP), + 'share_type' => $qb->expr()->literal(IShare::TYPE_GROUP), 'share_with' => $qb->expr()->literal('group'), 'uid_owner' => $qb->expr()->literal('user1'), 'uid_initiator' => $qb->expr()->literal('user1'), @@ -1489,7 +1489,7 @@ class DefaultShareProviderTest extends \Test\TestCase { $qb = $this->dbConn->getQueryBuilder(); $stmt = $qb->insert('share') ->values([ - 'share_type' => $qb->expr()->literal(\OCP\Share::SHARE_TYPE_GROUP), + 'share_type' => $qb->expr()->literal(IShare::TYPE_GROUP), 'share_with' => $qb->expr()->literal('group'), 'uid_owner' => $qb->expr()->literal('user1'), 'uid_initiator' => $qb->expr()->literal('user1'), @@ -1564,7 +1564,7 @@ class DefaultShareProviderTest extends \Test\TestCase { $qb = $this->dbConn->getQueryBuilder(); $stmt = $qb->insert('share') ->values([ - 'share_type' => $qb->expr()->literal(\OCP\Share::SHARE_TYPE_GROUP), + 'share_type' => $qb->expr()->literal(IShare::TYPE_GROUP), 'share_with' => $qb->expr()->literal('group'), 'uid_owner' => $qb->expr()->literal('user1'), 'uid_initiator' => $qb->expr()->literal('user1'), @@ -1609,7 +1609,7 @@ class DefaultShareProviderTest extends \Test\TestCase { $qb = $this->dbConn->getQueryBuilder(); $stmt = $qb->insert('share') ->values([ - 'share_type' => $qb->expr()->literal(\OCP\Share::SHARE_TYPE_GROUP), + 'share_type' => $qb->expr()->literal(IShare::TYPE_GROUP), 'share_with' => $qb->expr()->literal('group'), 'uid_owner' => $qb->expr()->literal('user1'), 'uid_initiator' => $qb->expr()->literal('user1'), @@ -1647,7 +1647,7 @@ class DefaultShareProviderTest extends \Test\TestCase { $qb = $this->dbConn->getQueryBuilder(); $stmt = $qb->insert('share') ->values([ - 'share_type' => $qb->expr()->literal(\OCP\Share::SHARE_TYPE_USER), + 'share_type' => $qb->expr()->literal(IShare::TYPE_USER), 'share_with' => $qb->expr()->literal('user2'), 'uid_owner' => $qb->expr()->literal('user1'), 'uid_initiator' => $qb->expr()->literal('user1'), @@ -1700,7 +1700,7 @@ class DefaultShareProviderTest extends \Test\TestCase { $qb = $this->dbConn->getQueryBuilder(); $stmt = $qb->insert('share') ->values([ - 'share_type' => $qb->expr()->literal(\OCP\Share::SHARE_TYPE_USER), + 'share_type' => $qb->expr()->literal(IShare::TYPE_USER), 'share_with' => $qb->expr()->literal('user2'), 'uid_owner' => $qb->expr()->literal('user1'), 'uid_initiator' => $qb->expr()->literal('user1'), @@ -1743,7 +1743,7 @@ class DefaultShareProviderTest extends \Test\TestCase { $qb = $this->dbConn->getQueryBuilder(); $stmt = $qb->insert('share') ->values([ - 'share_type' => $qb->expr()->literal(\OCP\Share::SHARE_TYPE_LINK), + 'share_type' => $qb->expr()->literal(IShare::TYPE_LINK), 'uid_owner' => $qb->expr()->literal('user1'), 'uid_initiator' => $qb->expr()->literal('user1'), 'item_type' => $qb->expr()->literal('file'), @@ -1773,7 +1773,7 @@ class DefaultShareProviderTest extends \Test\TestCase { } public function testUpdateUser() { - $id = $this->addShareToDB(\OCP\Share::SHARE_TYPE_USER, 'user0', 'user1', 'user2', + $id = $this->addShareToDB(IShare::TYPE_USER, 'user0', 'user1', 'user2', 'file', 42, 'target', 31, null, null); $users = []; @@ -1831,7 +1831,7 @@ class DefaultShareProviderTest extends \Test\TestCase { } public function testUpdateLink() { - $id = $this->addShareToDB(\OCP\Share::SHARE_TYPE_LINK, null, 'user1', 'user2', + $id = $this->addShareToDB(IShare::TYPE_LINK, null, 'user1', 'user2', 'file', 42, 'target', 31, null, null); $users = []; @@ -1891,7 +1891,7 @@ class DefaultShareProviderTest extends \Test\TestCase { } public function testUpdateLinkRemovePassword() { - $id = $this->addShareToDB(\OCP\Share::SHARE_TYPE_LINK, 'foo', 'user1', 'user2', + $id = $this->addShareToDB(IShare::TYPE_LINK, 'foo', 'user1', 'user2', 'file', 42, 'target', 31, null, null); $qb = $this->dbConn->getQueryBuilder(); @@ -1954,7 +1954,7 @@ class DefaultShareProviderTest extends \Test\TestCase { } public function testUpdateGroupNoSub() { - $id = $this->addShareToDB(\OCP\Share::SHARE_TYPE_GROUP, 'group0', 'user1', 'user2', + $id = $this->addShareToDB(IShare::TYPE_GROUP, 'group0', 'user1', 'user2', 'file', 42, 'target', 31, null, null); $users = []; @@ -2026,7 +2026,7 @@ class DefaultShareProviderTest extends \Test\TestCase { } public function testUpdateGroupSubShares() { - $id = $this->addShareToDB(\OCP\Share::SHARE_TYPE_GROUP, 'group0', 'user1', 'user2', + $id = $this->addShareToDB(IShare::TYPE_GROUP, 'group0', 'user1', 'user2', 'file', 42, 'target', 31, null, null); $id2 = $this->addShareToDB(2, 'user0', 'user1', 'user2', @@ -2126,7 +2126,7 @@ class DefaultShareProviderTest extends \Test\TestCase { } public function testMoveUserShare() { - $id = $this->addShareToDB(\OCP\Share::SHARE_TYPE_USER, 'user0', 'user1', 'user1', 'file', + $id = $this->addShareToDB(IShare::TYPE_USER, 'user0', 'user1', 'user1', 'file', 42, 'mytaret', 31, null, null); $user0 = $this->createMock(IUser::class); @@ -2157,7 +2157,7 @@ class DefaultShareProviderTest extends \Test\TestCase { } public function testMoveGroupShare() { - $id = $this->addShareToDB(\OCP\Share::SHARE_TYPE_GROUP, 'group0', 'user1', 'user1', 'file', + $id = $this->addShareToDB(IShare::TYPE_GROUP, 'group0', 'user1', 'user1', 'file', 42, 'mytaret', 31, null, null); $user0 = $this->createMock(IUser::class); @@ -2199,20 +2199,20 @@ class DefaultShareProviderTest extends \Test\TestCase { public function dataDeleteUser() { return [ - [\OCP\Share::SHARE_TYPE_USER, 'a', 'b', 'c', 'a', true], - [\OCP\Share::SHARE_TYPE_USER, 'a', 'b', 'c', 'b', false], - [\OCP\Share::SHARE_TYPE_USER, 'a', 'b', 'c', 'c', true], - [\OCP\Share::SHARE_TYPE_USER, 'a', 'b', 'c', 'd', false], - [\OCP\Share::SHARE_TYPE_GROUP, 'a', 'b', 'c', 'a', true], - [\OCP\Share::SHARE_TYPE_GROUP, 'a', 'b', 'c', 'b', false], + [IShare::TYPE_USER, 'a', 'b', 'c', 'a', true], + [IShare::TYPE_USER, 'a', 'b', 'c', 'b', false], + [IShare::TYPE_USER, 'a', 'b', 'c', 'c', true], + [IShare::TYPE_USER, 'a', 'b', 'c', 'd', false], + [IShare::TYPE_GROUP, 'a', 'b', 'c', 'a', true], + [IShare::TYPE_GROUP, 'a', 'b', 'c', 'b', false], // The group c is still valid but user c is deleted so group share stays - [\OCP\Share::SHARE_TYPE_GROUP, 'a', 'b', 'c', 'c', false], - [\OCP\Share::SHARE_TYPE_GROUP, 'a', 'b', 'c', 'd', false], - [\OCP\Share::SHARE_TYPE_LINK, 'a', 'b', 'c', 'a', true], + [IShare::TYPE_GROUP, 'a', 'b', 'c', 'c', false], + [IShare::TYPE_GROUP, 'a', 'b', 'c', 'd', false], + [IShare::TYPE_LINK, 'a', 'b', 'c', 'a', true], // To avoid invisible link shares delete initiated link shares as well (see #22327) - [\OCP\Share::SHARE_TYPE_LINK, 'a', 'b', 'c', 'b', true], - [\OCP\Share::SHARE_TYPE_LINK, 'a', 'b', 'c', 'c', false], - [\OCP\Share::SHARE_TYPE_LINK, 'a', 'b', 'c', 'd', false], + [IShare::TYPE_LINK, 'a', 'b', 'c', 'b', true], + [IShare::TYPE_LINK, 'a', 'b', 'c', 'c', false], + [IShare::TYPE_LINK, 'a', 'b', 'c', 'd', false], ]; } @@ -2277,7 +2277,7 @@ class DefaultShareProviderTest extends \Test\TestCase { public function testDeleteUserGroup($owner, $initiator, $recipient, $deletedUser, $groupShareDeleted, $userGroupShareDeleted) { $qb = $this->dbConn->getQueryBuilder(); $qb->insert('share') - ->setValue('share_type', $qb->createNamedParameter(\OCP\Share::SHARE_TYPE_GROUP)) + ->setValue('share_type', $qb->createNamedParameter(IShare::TYPE_GROUP)) ->setValue('uid_owner', $qb->createNamedParameter($owner)) ->setValue('uid_initiator', $qb->createNamedParameter($initiator)) ->setValue('share_with', $qb->createNamedParameter('group')) @@ -2299,7 +2299,7 @@ class DefaultShareProviderTest extends \Test\TestCase { ->execute(); $userGroupId = $qb->getLastInsertId(); - $this->provider->userDeleted($deletedUser, \OCP\Share::SHARE_TYPE_GROUP); + $this->provider->userDeleted($deletedUser, IShare::TYPE_GROUP); $qb = $this->dbConn->getQueryBuilder(); $qb->select('*') @@ -2328,28 +2328,28 @@ class DefaultShareProviderTest extends \Test\TestCase { return [ [ [ - 'type' => \OCP\Share::SHARE_TYPE_USER, + 'type' => IShare::TYPE_USER, 'recipient' => 'user', 'children' => [] ], 'group', false ], [ [ - 'type' => \OCP\Share::SHARE_TYPE_USER, + 'type' => IShare::TYPE_USER, 'recipient' => 'user', 'children' => [] ], 'user', false ], [ [ - 'type' => \OCP\Share::SHARE_TYPE_LINK, + 'type' => IShare::TYPE_LINK, 'recipient' => 'user', 'children' => [] ], 'group', false ], [ [ - 'type' => \OCP\Share::SHARE_TYPE_GROUP, + 'type' => IShare::TYPE_GROUP, 'recipient' => 'group1', 'children' => [ 'foo', @@ -2359,7 +2359,7 @@ class DefaultShareProviderTest extends \Test\TestCase { ], [ [ - 'type' => \OCP\Share::SHARE_TYPE_GROUP, + 'type' => IShare::TYPE_GROUP, 'recipient' => 'group1', 'children' => [ 'foo', @@ -2440,7 +2440,7 @@ class DefaultShareProviderTest extends \Test\TestCase { public function testUserDeletedFromGroup($group, $user, $toDelete) { $qb = $this->dbConn->getQueryBuilder(); $qb->insert('share') - ->setValue('share_type', $qb->createNamedParameter(\OCP\Share::SHARE_TYPE_GROUP)) + ->setValue('share_type', $qb->createNamedParameter(IShare::TYPE_GROUP)) ->setValue('uid_owner', $qb->createNamedParameter('owner')) ->setValue('uid_initiator', $qb->createNamedParameter('initiator')) ->setValue('share_with', $qb->createNamedParameter('group1')) @@ -2512,7 +2512,7 @@ class DefaultShareProviderTest extends \Test\TestCase { ->setSharedBy($u1->getUID()) ->setSharedWith($u2->getUID()) ->setShareOwner($u1->getUID()) - ->setShareType(\OCP\Share::SHARE_TYPE_USER) + ->setShareType(IShare::TYPE_USER) ->setPermissions(\OCP\Constants::PERMISSION_ALL); $share1 = $this->provider->create($share1); @@ -2521,7 +2521,7 @@ class DefaultShareProviderTest extends \Test\TestCase { ->setSharedBy($u2->getUID()) ->setSharedWith($u3->getUID()) ->setShareOwner($u1->getUID()) - ->setShareType(\OCP\Share::SHARE_TYPE_USER) + ->setShareType(IShare::TYPE_USER) ->setPermissions(\OCP\Constants::PERMISSION_READ); $share2 = $this->provider->create($share2); @@ -2529,7 +2529,7 @@ class DefaultShareProviderTest extends \Test\TestCase { $share3->setNode($folder2) ->setSharedBy($u2->getUID()) ->setShareOwner($u1->getUID()) - ->setShareType(\OCP\Share::SHARE_TYPE_LINK) + ->setShareType(IShare::TYPE_LINK) ->setPermissions(\OCP\Constants::PERMISSION_READ); $share3 = $this->provider->create($share3); @@ -2538,7 +2538,7 @@ class DefaultShareProviderTest extends \Test\TestCase { ->setSharedBy($u1->getUID()) ->setSharedWith($g1->getGID()) ->setShareOwner($u1->getUID()) - ->setShareType(\OCP\Share::SHARE_TYPE_GROUP) + ->setShareType(IShare::TYPE_GROUP) ->setPermissions(\OCP\Constants::PERMISSION_READ); $share4 = $this->provider->create($share4); @@ -2554,14 +2554,14 @@ class DefaultShareProviderTest extends \Test\TestCase { $file_shares = $result[$file1->getId()]; $this->assertCount(1, $file_shares); $this->assertSame($file1->getId(), $file_shares[0]->getNodeId()); - $this->assertSame(\OCP\Share::SHARE_TYPE_USER, $file_shares[0]->getShareType()); + $this->assertSame(IShare::TYPE_USER, $file_shares[0]->getShareType()); $folder_shares = $result[$folder2->getId()]; $this->assertCount(2, $folder_shares); $this->assertSame($folder2->getId(), $folder_shares[0]->getNodeId()); $this->assertSame($folder2->getId(), $folder_shares[1]->getNodeId()); - $this->assertSame(\OCP\Share::SHARE_TYPE_LINK, $folder_shares[0]->getShareType()); - $this->assertSame(\OCP\Share::SHARE_TYPE_GROUP, $folder_shares[1]->getShareType()); + $this->assertSame(IShare::TYPE_LINK, $folder_shares[0]->getShareType()); + $this->assertSame(IShare::TYPE_GROUP, $folder_shares[1]->getShareType()); $provider->delete($share1); $provider->delete($share2); @@ -2616,7 +2616,7 @@ class DefaultShareProviderTest extends \Test\TestCase { ->setSharedBy($u1->getUID()) ->setSharedWith($u2->getUID()) ->setShareOwner($u1->getUID()) - ->setShareType(\OCP\Share::SHARE_TYPE_USER) + ->setShareType(IShare::TYPE_USER) ->setPermissions(\OCP\Constants::PERMISSION_ALL); $share1 = $this->provider->create($share1); @@ -2625,7 +2625,7 @@ class DefaultShareProviderTest extends \Test\TestCase { ->setSharedBy($u2->getUID()) ->setSharedWith($g1->getGID()) ->setShareOwner($u1->getUID()) - ->setShareType(\OCP\Share::SHARE_TYPE_GROUP) + ->setShareType(IShare::TYPE_GROUP) ->setPermissions(\OCP\Constants::PERMISSION_ALL); $share2 = $this->provider->create($share2); @@ -2635,7 +2635,7 @@ class DefaultShareProviderTest extends \Test\TestCase { $share3->setNode($file1) ->setSharedBy($u3->getUID()) ->setShareOwner($u1->getUID()) - ->setShareType(\OCP\Share::SHARE_TYPE_LINK) + ->setShareType(IShare::TYPE_LINK) ->setPermissions(\OCP\Constants::PERMISSION_READ); $share3 = $this->provider->create($share3); @@ -2644,7 +2644,7 @@ class DefaultShareProviderTest extends \Test\TestCase { ->setSharedBy($u3->getUID()) ->setSharedWith($u5->getUID()) ->setShareOwner($u1->getUID()) - ->setShareType(\OCP\Share::SHARE_TYPE_USER) + ->setShareType(IShare::TYPE_USER) ->setPermissions(\OCP\Constants::PERMISSION_READ); $share4 = $this->provider->create($share4); @@ -2712,7 +2712,7 @@ class DefaultShareProviderTest extends \Test\TestCase { ->setSharedBy($u1->getUID()) ->setSharedWith($u2->getUID()) ->setShareOwner($u1->getUID()) - ->setShareType(\OCP\Share::SHARE_TYPE_USER) + ->setShareType(IShare::TYPE_USER) ->setPermissions(\OCP\Constants::PERMISSION_ALL); $share1 = $this->provider->create($share1); @@ -2721,7 +2721,7 @@ class DefaultShareProviderTest extends \Test\TestCase { ->setSharedBy($u2->getUID()) ->setSharedWith($g1->getGID()) ->setShareOwner($u1->getUID()) - ->setShareType(\OCP\Share::SHARE_TYPE_GROUP) + ->setShareType(IShare::TYPE_GROUP) ->setPermissions(\OCP\Constants::PERMISSION_ALL); $share2 = $this->provider->create($share2); @@ -2731,7 +2731,7 @@ class DefaultShareProviderTest extends \Test\TestCase { $share3->setNode($file1) ->setSharedBy($u3->getUID()) ->setShareOwner($u1->getUID()) - ->setShareType(\OCP\Share::SHARE_TYPE_LINK) + ->setShareType(IShare::TYPE_LINK) ->setPermissions(\OCP\Constants::PERMISSION_READ); $share3 = $this->provider->create($share3); @@ -2740,7 +2740,7 @@ class DefaultShareProviderTest extends \Test\TestCase { ->setSharedBy($u3->getUID()) ->setSharedWith($u5->getUID()) ->setShareOwner($u1->getUID()) - ->setShareType(\OCP\Share::SHARE_TYPE_USER) + ->setShareType(IShare::TYPE_USER) ->setPermissions(\OCP\Constants::PERMISSION_READ); $share4 = $this->provider->create($share4); @@ -2770,7 +2770,7 @@ class DefaultShareProviderTest extends \Test\TestCase { $qb->insert('share') ->values([ - 'share_type' => $qb->expr()->literal(\OCP\Share::SHARE_TYPE_USER), + 'share_type' => $qb->expr()->literal(IShare::TYPE_USER), 'share_with' => $qb->expr()->literal('sharedWith1'), 'uid_owner' => $qb->expr()->literal('shareOwner1'), 'uid_initiator' => $qb->expr()->literal('sharedBy1'), @@ -2785,7 +2785,7 @@ class DefaultShareProviderTest extends \Test\TestCase { $qb->insert('share') ->values([ - 'share_type' => $qb->expr()->literal(\OCP\Share::SHARE_TYPE_GROUP), + 'share_type' => $qb->expr()->literal(IShare::TYPE_GROUP), 'share_with' => $qb->expr()->literal('sharedWith2'), 'uid_owner' => $qb->expr()->literal('shareOwner2'), 'uid_initiator' => $qb->expr()->literal('sharedBy2'), @@ -2800,7 +2800,7 @@ class DefaultShareProviderTest extends \Test\TestCase { $qb->insert('share') ->values([ - 'share_type' => $qb->expr()->literal(\OCP\Share::SHARE_TYPE_LINK), + 'share_type' => $qb->expr()->literal(IShare::TYPE_LINK), 'token' => $qb->expr()->literal('token3'), 'uid_owner' => $qb->expr()->literal('shareOwner3'), 'uid_initiator' => $qb->expr()->literal('sharedBy3'), @@ -2815,7 +2815,7 @@ class DefaultShareProviderTest extends \Test\TestCase { $qb->insert('share') ->values([ - 'share_type' => $qb->expr()->literal(\OCP\Share::SHARE_TYPE_EMAIL), + 'share_type' => $qb->expr()->literal(IShare::TYPE_EMAIL), 'share_with' => $qb->expr()->literal('shareOwner4'), 'token' => $qb->expr()->literal('token4'), 'uid_owner' => $qb->expr()->literal('shareOwner4'), @@ -2831,7 +2831,7 @@ class DefaultShareProviderTest extends \Test\TestCase { $qb->insert('share') ->values([ - 'share_type' => $qb->expr()->literal(\OCP\Share::SHARE_TYPE_LINK), + 'share_type' => $qb->expr()->literal(IShare::TYPE_LINK), 'token' => $qb->expr()->literal('token5'), 'uid_owner' => $qb->expr()->literal('shareOwner5'), 'uid_initiator' => $qb->expr()->literal('sharedBy5'), @@ -2884,7 +2884,7 @@ class DefaultShareProviderTest extends \Test\TestCase { // We fetch the node so the root folder is eventually called $this->assertEquals($id1, $share->getId()); - $this->assertEquals(\OCP\Share::SHARE_TYPE_USER, $share->getShareType()); + $this->assertEquals(IShare::TYPE_USER, $share->getShareType()); $this->assertEquals('sharedWith1', $share->getSharedWith()); $this->assertEquals('sharedBy1', $share->getSharedBy()); $this->assertEquals('shareOwner1', $share->getShareOwner()); @@ -2896,7 +2896,7 @@ class DefaultShareProviderTest extends \Test\TestCase { $share = $shares[1]; $this->assertEquals($id2, $share->getId()); - $this->assertEquals(\OCP\Share::SHARE_TYPE_GROUP, $share->getShareType()); + $this->assertEquals(IShare::TYPE_GROUP, $share->getShareType()); $this->assertEquals('sharedWith2', $share->getSharedWith()); $this->assertEquals('sharedBy2', $share->getSharedBy()); $this->assertEquals('shareOwner2', $share->getShareOwner()); @@ -2908,7 +2908,7 @@ class DefaultShareProviderTest extends \Test\TestCase { $share = $shares[2]; $this->assertEquals($id3, $share->getId()); - $this->assertEquals(\OCP\Share::SHARE_TYPE_LINK, $share->getShareType()); + $this->assertEquals(IShare::TYPE_LINK, $share->getShareType()); $this->assertEquals(null, $share->getSharedWith()); $this->assertEquals('sharedBy3', $share->getSharedBy()); $this->assertEquals('shareOwner3', $share->getShareOwner()); @@ -2920,7 +2920,7 @@ class DefaultShareProviderTest extends \Test\TestCase { $share = $shares[3]; $this->assertEquals($id5, $share->getId()); - $this->assertEquals(\OCP\Share::SHARE_TYPE_LINK, $share->getShareType()); + $this->assertEquals(IShare::TYPE_LINK, $share->getShareType()); $this->assertEquals(null, $share->getSharedWith()); $this->assertEquals('sharedBy5', $share->getSharedBy()); $this->assertEquals('shareOwner5', $share->getShareOwner()); diff --git a/tests/lib/Share20/LegacyHooksTest.php b/tests/lib/Share20/LegacyHooksTest.php index 2b062e592ba..66dbafe7691 100644 --- a/tests/lib/Share20/LegacyHooksTest.php +++ b/tests/lib/Share20/LegacyHooksTest.php @@ -27,6 +27,7 @@ use OC\Share20\LegacyHooks; use OC\Share20\Manager; use OCP\Constants; use OCP\Files\File; +use OCP\Share\IShare; use Symfony\Component\EventDispatcher\EventDispatcher; use Symfony\Component\EventDispatcher\GenericEvent; use Test\TestCase; @@ -57,7 +58,7 @@ class LegacyHooksTest extends TestCase { $share = $this->manager->newShare(); $share->setId(42) ->setProviderId('prov') - ->setShareType(\OCP\Share::SHARE_TYPE_USER) + ->setShareType(IShare::TYPE_USER) ->setSharedWith('awesomeUser') ->setSharedBy('sharedBy') ->setNode($path) @@ -70,7 +71,7 @@ class LegacyHooksTest extends TestCase { 'id' => 42, 'itemType' => 'file', 'itemSource' => 1, - 'shareType' => \OCP\Share::SHARE_TYPE_USER, + 'shareType' => IShare::TYPE_USER, 'shareWith' => 'awesomeUser', 'itemparent' => null, 'uidOwner' => 'sharedBy', @@ -94,7 +95,7 @@ class LegacyHooksTest extends TestCase { $share = $this->manager->newShare(); $share->setId(42) ->setProviderId('prov') - ->setShareType(\OCP\Share::SHARE_TYPE_USER) + ->setShareType(IShare::TYPE_USER) ->setSharedWith('awesomeUser') ->setSharedBy('sharedBy') ->setNode($path) @@ -107,7 +108,7 @@ class LegacyHooksTest extends TestCase { 'id' => 42, 'itemType' => 'file', 'itemSource' => 1, - 'shareType' => \OCP\Share::SHARE_TYPE_USER, + 'shareType' => IShare::TYPE_USER, 'shareWith' => 'awesomeUser', 'itemparent' => null, 'uidOwner' => 'sharedBy', @@ -118,7 +119,7 @@ class LegacyHooksTest extends TestCase { 'id' => 42, 'itemType' => 'file', 'itemSource' => 1, - 'shareType' => \OCP\Share::SHARE_TYPE_USER, + 'shareType' => IShare::TYPE_USER, 'shareWith' => 'awesomeUser', 'itemparent' => null, 'uidOwner' => 'sharedBy', @@ -145,7 +146,7 @@ class LegacyHooksTest extends TestCase { $share = $this->manager->newShare(); $share->setId(42) ->setProviderId('prov') - ->setShareType(\OCP\Share::SHARE_TYPE_USER) + ->setShareType(IShare::TYPE_USER) ->setSharedWith('awesomeUser') ->setSharedBy('sharedBy') ->setNode($path) @@ -158,7 +159,7 @@ class LegacyHooksTest extends TestCase { 'id' => 42, 'itemType' => 'file', 'itemSource' => 1, - 'shareType' => \OCP\Share::SHARE_TYPE_USER, + 'shareType' => IShare::TYPE_USER, 'shareWith' => 'awesomeUser', 'itemparent' => null, 'uidOwner' => 'sharedBy', @@ -170,7 +171,7 @@ class LegacyHooksTest extends TestCase { 'id' => 42, 'itemType' => 'file', 'itemSource' => 1, - 'shareType' => \OCP\Share::SHARE_TYPE_USER, + 'shareType' => IShare::TYPE_USER, 'shareWith' => 'awesomeUser', 'itemparent' => null, 'uidOwner' => 'sharedBy', @@ -197,7 +198,7 @@ class LegacyHooksTest extends TestCase { $date = new \DateTime(); $share = $this->manager->newShare(); - $share->setShareType(\OCP\Share::SHARE_TYPE_LINK) + $share->setShareType(IShare::TYPE_LINK) ->setSharedWith('awesomeUser') ->setSharedBy('sharedBy') ->setNode($path) @@ -217,7 +218,7 @@ class LegacyHooksTest extends TestCase { $expected = [ 'itemType' => 'file', 'itemSource' => 1, - 'shareType' => \OCP\Share::SHARE_TYPE_LINK, + 'shareType' => IShare::TYPE_LINK, 'shareWith' => 'awesomeUser', 'uidOwner' => 'sharedBy', 'fileSource' => 1, @@ -245,7 +246,7 @@ class LegacyHooksTest extends TestCase { $date = new \DateTime(); $share = $this->manager->newShare(); - $share->setShareType(\OCP\Share::SHARE_TYPE_LINK) + $share->setShareType(IShare::TYPE_LINK) ->setSharedWith('awesomeUser') ->setSharedBy('sharedBy') ->setNode($path) @@ -265,7 +266,7 @@ class LegacyHooksTest extends TestCase { $expected = [ 'itemType' => 'file', 'itemSource' => 1, - 'shareType' => \OCP\Share::SHARE_TYPE_LINK, + 'shareType' => IShare::TYPE_LINK, 'shareWith' => 'awesomeUser', 'uidOwner' => 'sharedBy', 'fileSource' => 1, @@ -301,7 +302,7 @@ class LegacyHooksTest extends TestCase { $share = $this->manager->newShare(); $share->setId(42) - ->setShareType(\OCP\Share::SHARE_TYPE_LINK) + ->setShareType(IShare::TYPE_LINK) ->setSharedWith('awesomeUser') ->setSharedBy('sharedBy') ->setNode($path) @@ -319,7 +320,7 @@ class LegacyHooksTest extends TestCase { 'id' => 42, 'itemType' => 'file', 'itemSource' => 1, - 'shareType' => \OCP\Share::SHARE_TYPE_LINK, + 'shareType' => IShare::TYPE_LINK, 'shareWith' => 'awesomeUser', 'uidOwner' => 'sharedBy', 'fileSource' => 1, diff --git a/tests/lib/Share20/ManagerTest.php b/tests/lib/Share20/ManagerTest.php index e66ac51aeea..65a5ff8946d 100644 --- a/tests/lib/Share20/ManagerTest.php +++ b/tests/lib/Share20/ManagerTest.php @@ -194,10 +194,10 @@ class ManagerTest extends \Test\TestCase { $group->method('getGID')->willReturn('sharedWithGroup'); return [ - [\OCP\Share::SHARE_TYPE_USER, 'sharedWithUser'], - [\OCP\Share::SHARE_TYPE_GROUP, 'sharedWithGroup'], - [\OCP\Share::SHARE_TYPE_LINK, ''], - [\OCP\Share::SHARE_TYPE_REMOTE, 'foo@bar.com'], + [IShare::TYPE_USER, 'sharedWithUser'], + [IShare::TYPE_GROUP, 'sharedWithGroup'], + [IShare::TYPE_LINK, ''], + [IShare::TYPE_REMOTE, 'foo@bar.com'], ]; } @@ -257,7 +257,7 @@ class ManagerTest extends \Test\TestCase { $share = $this->manager->newShare(); $share->setId(42) ->setProviderId('prov') - ->setShareType(\OCP\Share::SHARE_TYPE_USER) + ->setShareType(IShare::TYPE_USER) ->setSharedWith('sharedWith') ->setSharedBy('sharedBy') ->setShareOwner('shareOwner') @@ -306,7 +306,7 @@ class ManagerTest extends \Test\TestCase { $share1 = $this->manager->newShare(); $share1->setId(42) ->setProviderId('prov') - ->setShareType(\OCP\Share::SHARE_TYPE_USER) + ->setShareType(IShare::TYPE_USER) ->setSharedWith('sharedWith1') ->setSharedBy('sharedBy1') ->setNode($path) @@ -315,7 +315,7 @@ class ManagerTest extends \Test\TestCase { $share2 = $this->manager->newShare(); $share2->setId(43) ->setProviderId('prov') - ->setShareType(\OCP\Share::SHARE_TYPE_GROUP) + ->setShareType(IShare::TYPE_GROUP) ->setSharedWith('sharedWith2') ->setSharedBy('sharedBy2') ->setNode($path) @@ -325,7 +325,7 @@ class ManagerTest extends \Test\TestCase { $share3 = $this->manager->newShare(); $share3->setId(44) ->setProviderId('prov') - ->setShareType(\OCP\Share::SHARE_TYPE_LINK) + ->setShareType(IShare::TYPE_LINK) ->setSharedBy('sharedBy3') ->setNode($path) ->setTarget('myTarget3') @@ -373,7 +373,7 @@ class ManagerTest extends \Test\TestCase { $share = $this->manager->newShare(); $share->setId(42) ->setProviderId('prov') - ->setShareType(\OCP\Share::SHARE_TYPE_USER) + ->setShareType(IShare::TYPE_USER) ->setSharedWith('sharedWith') ->setSharedBy('sharedBy') ->setShareOwner('shareOwner') @@ -404,14 +404,14 @@ class ManagerTest extends \Test\TestCase { ->getMock(); $share = $this->createMock(IShare::class); - $share->method('getShareType')->willReturn(\OCP\Share::SHARE_TYPE_USER); + $share->method('getShareType')->willReturn(IShare::TYPE_USER); $child1 = $this->createMock(IShare::class); - $child1->method('getShareType')->willReturn(\OCP\Share::SHARE_TYPE_USER); + $child1->method('getShareType')->willReturn(IShare::TYPE_USER); $child2 = $this->createMock(IShare::class); - $child2->method('getShareType')->willReturn(\OCP\Share::SHARE_TYPE_USER); + $child2->method('getShareType')->willReturn(IShare::TYPE_USER); $child3 = $this->createMock(IShare::class); - $child3->method('getShareType')->willReturn(\OCP\Share::SHARE_TYPE_USER); + $child3->method('getShareType')->willReturn(IShare::TYPE_USER); $shares = [ $child1, @@ -463,7 +463,7 @@ class ManagerTest extends \Test\TestCase { $share = $this->manager->newShare(); $share->setExpirationDate($date) - ->setShareType(\OCP\Share::SHARE_TYPE_LINK); + ->setShareType(IShare::TYPE_LINK); $this->defaultProvider->expects($this->once()) ->method('getShareById') @@ -572,30 +572,30 @@ class ManagerTest extends \Test\TestCase { ->willReturn($storage); $data = [ - [$this->createShare(null, \OCP\Share::SHARE_TYPE_USER, $file, null, $user0, $user0, 31, null, null), 'SharedWith is not a valid user', true], - [$this->createShare(null, \OCP\Share::SHARE_TYPE_USER, $file, $group0, $user0, $user0, 31, null, null), 'SharedWith is not a valid user', true], - [$this->createShare(null, \OCP\Share::SHARE_TYPE_USER, $file, 'foo@bar.com', $user0, $user0, 31, null, null), 'SharedWith is not a valid user', true], - [$this->createShare(null, \OCP\Share::SHARE_TYPE_GROUP, $file, null, $user0, $user0, 31, null, null), 'SharedWith is not a valid group', true], - [$this->createShare(null, \OCP\Share::SHARE_TYPE_GROUP, $file, $user2, $user0, $user0, 31, null, null), 'SharedWith is not a valid group', true], - [$this->createShare(null, \OCP\Share::SHARE_TYPE_GROUP, $file, 'foo@bar.com', $user0, $user0, 31, null, null), 'SharedWith is not a valid group', true], - [$this->createShare(null, \OCP\Share::SHARE_TYPE_LINK, $file, $user2, $user0, $user0, 31, null, null), 'SharedWith should be empty', true], - [$this->createShare(null, \OCP\Share::SHARE_TYPE_LINK, $file, $group0, $user0, $user0, 31, null, null), 'SharedWith should be empty', true], - [$this->createShare(null, \OCP\Share::SHARE_TYPE_LINK, $file, 'foo@bar.com', $user0, $user0, 31, null, null), 'SharedWith should be empty', true], + [$this->createShare(null, IShare::TYPE_USER, $file, null, $user0, $user0, 31, null, null), 'SharedWith is not a valid user', true], + [$this->createShare(null, IShare::TYPE_USER, $file, $group0, $user0, $user0, 31, null, null), 'SharedWith is not a valid user', true], + [$this->createShare(null, IShare::TYPE_USER, $file, 'foo@bar.com', $user0, $user0, 31, null, null), 'SharedWith is not a valid user', true], + [$this->createShare(null, IShare::TYPE_GROUP, $file, null, $user0, $user0, 31, null, null), 'SharedWith is not a valid group', true], + [$this->createShare(null, IShare::TYPE_GROUP, $file, $user2, $user0, $user0, 31, null, null), 'SharedWith is not a valid group', true], + [$this->createShare(null, IShare::TYPE_GROUP, $file, 'foo@bar.com', $user0, $user0, 31, null, null), 'SharedWith is not a valid group', true], + [$this->createShare(null, IShare::TYPE_LINK, $file, $user2, $user0, $user0, 31, null, null), 'SharedWith should be empty', true], + [$this->createShare(null, IShare::TYPE_LINK, $file, $group0, $user0, $user0, 31, null, null), 'SharedWith should be empty', true], + [$this->createShare(null, IShare::TYPE_LINK, $file, 'foo@bar.com', $user0, $user0, 31, null, null), 'SharedWith should be empty', true], [$this->createShare(null, -1, $file, null, $user0, $user0, 31, null, null), 'unknown share type', true], - [$this->createShare(null, \OCP\Share::SHARE_TYPE_USER, $file, $user2, null, $user0, 31, null, null), 'SharedBy should be set', true], - [$this->createShare(null, \OCP\Share::SHARE_TYPE_GROUP, $file, $group0, null, $user0, 31, null, null), 'SharedBy should be set', true], - [$this->createShare(null, \OCP\Share::SHARE_TYPE_LINK, $file, null, null, $user0, 31, null, null), 'SharedBy should be set', true], + [$this->createShare(null, IShare::TYPE_USER, $file, $user2, null, $user0, 31, null, null), 'SharedBy should be set', true], + [$this->createShare(null, IShare::TYPE_GROUP, $file, $group0, null, $user0, 31, null, null), 'SharedBy should be set', true], + [$this->createShare(null, IShare::TYPE_LINK, $file, null, null, $user0, 31, null, null), 'SharedBy should be set', true], - [$this->createShare(null, \OCP\Share::SHARE_TYPE_USER, $file, $user0, $user0, $user0, 31, null, null), 'Can’t share with yourself', true], + [$this->createShare(null, IShare::TYPE_USER, $file, $user0, $user0, $user0, 31, null, null), 'Can’t share with yourself', true], - [$this->createShare(null, \OCP\Share::SHARE_TYPE_USER, null, $user2, $user0, $user0, 31, null, null), 'Path should be set', true], - [$this->createShare(null, \OCP\Share::SHARE_TYPE_GROUP, null, $group0, $user0, $user0, 31, null, null), 'Path should be set', true], - [$this->createShare(null, \OCP\Share::SHARE_TYPE_LINK, null, null, $user0, $user0, 31, null, null), 'Path should be set', true], + [$this->createShare(null, IShare::TYPE_USER, null, $user2, $user0, $user0, 31, null, null), 'Path should be set', true], + [$this->createShare(null, IShare::TYPE_GROUP, null, $group0, $user0, $user0, 31, null, null), 'Path should be set', true], + [$this->createShare(null, IShare::TYPE_LINK, null, null, $user0, $user0, 31, null, null), 'Path should be set', true], - [$this->createShare(null, \OCP\Share::SHARE_TYPE_USER, $node, $user2, $user0, $user0, 31, null, null), 'Path should be either a file or a folder', true], - [$this->createShare(null, \OCP\Share::SHARE_TYPE_GROUP, $node, $group0, $user0, $user0, 31, null, null), 'Path should be either a file or a folder', true], - [$this->createShare(null, \OCP\Share::SHARE_TYPE_LINK, $node, null, $user0, $user0, 31, null, null), 'Path should be either a file or a folder', true], + [$this->createShare(null, IShare::TYPE_USER, $node, $user2, $user0, $user0, 31, null, null), 'Path should be either a file or a folder', true], + [$this->createShare(null, IShare::TYPE_GROUP, $node, $group0, $user0, $user0, 31, null, null), 'Path should be either a file or a folder', true], + [$this->createShare(null, IShare::TYPE_LINK, $node, null, $user0, $user0, 31, null, null), 'Path should be either a file or a folder', true], ]; $nonShareAble = $this->createMock(Folder::class); @@ -606,9 +606,9 @@ class ManagerTest extends \Test\TestCase { $nonShareAble->method('getStorage') ->willReturn($storage); - $data[] = [$this->createShare(null, \OCP\Share::SHARE_TYPE_USER, $nonShareAble, $user2, $user0, $user0, 31, null, null), 'You are not allowed to share path', true]; - $data[] = [$this->createShare(null, \OCP\Share::SHARE_TYPE_GROUP, $nonShareAble, $group0, $user0, $user0, 31, null, null), 'You are not allowed to share path', true]; - $data[] = [$this->createShare(null, \OCP\Share::SHARE_TYPE_LINK, $nonShareAble, null, $user0, $user0, 31, null, null), 'You are not allowed to share path', true]; + $data[] = [$this->createShare(null, IShare::TYPE_USER, $nonShareAble, $user2, $user0, $user0, 31, null, null), 'You are not allowed to share path', true]; + $data[] = [$this->createShare(null, IShare::TYPE_GROUP, $nonShareAble, $group0, $user0, $user0, 31, null, null), 'You are not allowed to share path', true]; + $data[] = [$this->createShare(null, IShare::TYPE_LINK, $nonShareAble, null, $user0, $user0, 31, null, null), 'You are not allowed to share path', true]; $limitedPermssions = $this->createMock(File::class); $limitedPermssions->method('isShareable')->willReturn(true); @@ -619,17 +619,17 @@ class ManagerTest extends \Test\TestCase { $limitedPermssions->method('getStorage') ->willReturn($storage); - $data[] = [$this->createShare(null, \OCP\Share::SHARE_TYPE_USER, $limitedPermssions, $user2, $user0, $user0, null, null, null), 'A share requires permissions', true]; - $data[] = [$this->createShare(null, \OCP\Share::SHARE_TYPE_GROUP, $limitedPermssions, $group0, $user0, $user0, null, null, null), 'A share requires permissions', true]; - $data[] = [$this->createShare(null, \OCP\Share::SHARE_TYPE_LINK, $limitedPermssions, null, $user0, $user0, null, null, null), 'A share requires permissions', true]; + $data[] = [$this->createShare(null, IShare::TYPE_USER, $limitedPermssions, $user2, $user0, $user0, null, null, null), 'A share requires permissions', true]; + $data[] = [$this->createShare(null, IShare::TYPE_GROUP, $limitedPermssions, $group0, $user0, $user0, null, null, null), 'A share requires permissions', true]; + $data[] = [$this->createShare(null, IShare::TYPE_LINK, $limitedPermssions, null, $user0, $user0, null, null, null), 'A share requires permissions', true]; $mount = $this->createMock(MoveableMount::class); $limitedPermssions->method('getMountPoint')->willReturn($mount); - $data[] = [$this->createShare(null, \OCP\Share::SHARE_TYPE_USER, $limitedPermssions, $user2, $user0, $user0, 31, null, null), 'Can’t increase permissions of path', true]; - $data[] = [$this->createShare(null, \OCP\Share::SHARE_TYPE_GROUP, $limitedPermssions, $group0, $user0, $user0, 17, null, null), 'Can’t increase permissions of path', true]; - $data[] = [$this->createShare(null, \OCP\Share::SHARE_TYPE_LINK, $limitedPermssions, null, $user0, $user0, 3, null, null), 'Can’t increase permissions of path', true]; + $data[] = [$this->createShare(null, IShare::TYPE_USER, $limitedPermssions, $user2, $user0, $user0, 31, null, null), 'Can’t increase permissions of path', true]; + $data[] = [$this->createShare(null, IShare::TYPE_GROUP, $limitedPermssions, $group0, $user0, $user0, 17, null, null), 'Can’t increase permissions of path', true]; + $data[] = [$this->createShare(null, IShare::TYPE_LINK, $limitedPermssions, null, $user0, $user0, 3, null, null), 'Can’t increase permissions of path', true]; $nonMoveableMountPermssions = $this->createMock(Folder::class); $nonMoveableMountPermssions->method('isShareable')->willReturn(true); @@ -640,17 +640,17 @@ class ManagerTest extends \Test\TestCase { $nonMoveableMountPermssions->method('getStorage') ->willReturn($storage); - $data[] = [$this->createShare(null, \OCP\Share::SHARE_TYPE_USER, $nonMoveableMountPermssions, $user2, $user0, $user0, 11, null, null), 'Can’t increase permissions of path', false]; - $data[] = [$this->createShare(null, \OCP\Share::SHARE_TYPE_GROUP, $nonMoveableMountPermssions, $group0, $user0, $user0, 11, null, null), 'Can’t increase permissions of path', false]; + $data[] = [$this->createShare(null, IShare::TYPE_USER, $nonMoveableMountPermssions, $user2, $user0, $user0, 11, null, null), 'Can’t increase permissions of path', false]; + $data[] = [$this->createShare(null, IShare::TYPE_GROUP, $nonMoveableMountPermssions, $group0, $user0, $user0, 11, null, null), 'Can’t increase permissions of path', false]; $rootFolder = $this->createMock(Folder::class); $rootFolder->method('isShareable')->willReturn(true); $rootFolder->method('getPermissions')->willReturn(\OCP\Constants::PERMISSION_ALL); $rootFolder->method('getId')->willReturn(42); - $data[] = [$this->createShare(null, \OCP\Share::SHARE_TYPE_USER, $rootFolder, $user2, $user0, $user0, 30, null, null), 'You can’t share your root folder', true]; - $data[] = [$this->createShare(null, \OCP\Share::SHARE_TYPE_GROUP, $rootFolder, $group0, $user0, $user0, 2, null, null), 'You can’t share your root folder', true]; - $data[] = [$this->createShare(null, \OCP\Share::SHARE_TYPE_LINK, $rootFolder, null, $user0, $user0, 16, null, null), 'You can’t share your root folder', true]; + $data[] = [$this->createShare(null, IShare::TYPE_USER, $rootFolder, $user2, $user0, $user0, 30, null, null), 'You can’t share your root folder', true]; + $data[] = [$this->createShare(null, IShare::TYPE_GROUP, $rootFolder, $group0, $user0, $user0, 2, null, null), 'You can’t share your root folder', true]; + $data[] = [$this->createShare(null, IShare::TYPE_LINK, $rootFolder, null, $user0, $user0, 16, null, null), 'You can’t share your root folder', true]; $allPermssions = $this->createMock(Folder::class); $allPermssions->method('isShareable')->willReturn(true); @@ -660,12 +660,12 @@ class ManagerTest extends \Test\TestCase { $allPermssions->method('getStorage') ->willReturn($storage); - $data[] = [$this->createShare(null, \OCP\Share::SHARE_TYPE_USER, $allPermssions, $user2, $user0, $user0, 30, null, null), 'Shares need at least read permissions', true]; - $data[] = [$this->createShare(null, \OCP\Share::SHARE_TYPE_GROUP, $allPermssions, $group0, $user0, $user0, 2, null, null), 'Shares need at least read permissions', true]; + $data[] = [$this->createShare(null, IShare::TYPE_USER, $allPermssions, $user2, $user0, $user0, 30, null, null), 'Shares need at least read permissions', true]; + $data[] = [$this->createShare(null, IShare::TYPE_GROUP, $allPermssions, $group0, $user0, $user0, 2, null, null), 'Shares need at least read permissions', true]; - $data[] = [$this->createShare(null, \OCP\Share::SHARE_TYPE_USER, $allPermssions, $user2, $user0, $user0, 31, null, null), null, false]; - $data[] = [$this->createShare(null, \OCP\Share::SHARE_TYPE_GROUP, $allPermssions, $group0, $user0, $user0, 3, null, null), null, false]; - $data[] = [$this->createShare(null, \OCP\Share::SHARE_TYPE_LINK, $allPermssions, null, $user0, $user0, 17, null, null), null, false]; + $data[] = [$this->createShare(null, IShare::TYPE_USER, $allPermssions, $user2, $user0, $user0, 31, null, null), null, false]; + $data[] = [$this->createShare(null, IShare::TYPE_GROUP, $allPermssions, $group0, $user0, $user0, 3, null, null), null, false]; + $data[] = [$this->createShare(null, IShare::TYPE_LINK, $allPermssions, null, $user0, $user0, 17, null, null), null, false]; $remoteStorage = $this->createMock(Storage\IStorage::class); @@ -679,9 +679,9 @@ class ManagerTest extends \Test\TestCase { ->willReturn($owner); $remoteFile->method('getStorage') ->willReturn($storage); - $data[] = [$this->createShare(null, \OCP\Share::SHARE_TYPE_REMOTE, $remoteFile, $user2, $user0, $user0, 1, null, null), null, false]; - $data[] = [$this->createShare(null, \OCP\Share::SHARE_TYPE_REMOTE, $remoteFile, $user2, $user0, $user0, 3, null, null), null, false]; - $data[] = [$this->createShare(null, \OCP\Share::SHARE_TYPE_REMOTE, $remoteFile, $user2, $user0, $user0, 31, null, null), 'Can’t increase permissions of ', true]; + $data[] = [$this->createShare(null, IShare::TYPE_REMOTE, $remoteFile, $user2, $user0, $user0, 1, null, null), null, false]; + $data[] = [$this->createShare(null, IShare::TYPE_REMOTE, $remoteFile, $user2, $user0, $user0, 3, null, null), null, false]; + $data[] = [$this->createShare(null, IShare::TYPE_REMOTE, $remoteFile, $user2, $user0, $user0, 31, null, null), 'Can’t increase permissions of ', true]; return $data; } @@ -747,7 +747,7 @@ class ManagerTest extends \Test\TestCase { $share = $this->manager->newShare(); - $share->setShareType(\OCP\Share::SHARE_TYPE_USER) + $share->setShareType(IShare::TYPE_USER) ->setSharedWith('user0') ->setSharedBy('user1') ->setNode($userFolder); @@ -1118,7 +1118,7 @@ class ManagerTest extends \Test\TestCase { ->setId('bar'); $share2 = $this->manager->newShare(); - $share2->setShareType(\OCP\Share::SHARE_TYPE_GROUP) + $share2->setShareType(IShare::TYPE_GROUP) ->setShareOwner('shareOwner2') ->setProviderId('foo') ->setId('baz') @@ -1156,7 +1156,7 @@ class ManagerTest extends \Test\TestCase { ->setId('bar'); $share2 = $this->manager->newShare(); - $share2->setShareType(\OCP\Share::SHARE_TYPE_GROUP) + $share2->setShareType(IShare::TYPE_GROUP) ->setShareOwner('shareOwner2') ->setProviderId('foo') ->setId('baz') @@ -1185,7 +1185,7 @@ class ManagerTest extends \Test\TestCase { $this->userManager->method('get')->with('sharedWith')->willReturn($sharedWith); $share2 = $this->manager->newShare(); - $share2->setShareType(\OCP\Share::SHARE_TYPE_GROUP) + $share2->setShareType(IShare::TYPE_GROUP) ->setShareOwner('shareOwner2') ->setProviderId('foo') ->setId('baz'); @@ -1598,7 +1598,7 @@ class ManagerTest extends \Test\TestCase { $share = $this->createShare( null, - \OCP\Share::SHARE_TYPE_USER, + IShare::TYPE_USER, $path, 'sharedWith', 'sharedBy', @@ -1653,7 +1653,7 @@ class ManagerTest extends \Test\TestCase { $share = $this->createShare( null, - \OCP\Share::SHARE_TYPE_GROUP, + IShare::TYPE_GROUP, $path, 'sharedWith', 'sharedBy', @@ -1718,7 +1718,7 @@ class ManagerTest extends \Test\TestCase { $date = new \DateTime(); $share = $this->manager->newShare(); - $share->setShareType(\OCP\Share::SHARE_TYPE_LINK) + $share->setShareType(IShare::TYPE_LINK) ->setNode($path) ->setSharedBy('sharedBy') ->setPermissions(\OCP\Constants::PERMISSION_ALL) @@ -1776,7 +1776,7 @@ class ManagerTest extends \Test\TestCase { /** @var IShare $share */ $share = $e->getSubject(); - return $share->getShareType() === \OCP\Share::SHARE_TYPE_LINK && + return $share->getShareType() === IShare::TYPE_LINK && $share->getNode() === $path && $share->getSharedBy() === 'sharedBy' && $share->getPermissions() === \OCP\Constants::PERMISSION_ALL && @@ -1795,7 +1795,7 @@ class ManagerTest extends \Test\TestCase { /** @var IShare $share */ $share = $e->getSubject(); - return $share->getShareType() === \OCP\Share::SHARE_TYPE_LINK && + return $share->getShareType() === IShare::TYPE_LINK && $share->getNode() === $path && $share->getSharedBy() === 'sharedBy' && $share->getPermissions() === \OCP\Constants::PERMISSION_ALL && @@ -1841,7 +1841,7 @@ class ManagerTest extends \Test\TestCase { $path->method('getStorage')->willReturn($storage); $share = $this->manager->newShare(); - $share->setShareType(\OCP\Share::SHARE_TYPE_EMAIL) + $share->setShareType(IShare::TYPE_EMAIL) ->setNode($path) ->setSharedBy('sharedBy') ->setPermissions(\OCP\Constants::PERMISSION_ALL); @@ -1886,7 +1886,7 @@ class ManagerTest extends \Test\TestCase { /** @var IShare $share */ $share = $e->getSubject(); - return $share->getShareType() === \OCP\Share::SHARE_TYPE_EMAIL && + return $share->getShareType() === IShare::TYPE_EMAIL && $share->getNode() === $path && $share->getSharedBy() === 'sharedBy' && $share->getPermissions() === \OCP\Constants::PERMISSION_ALL && @@ -1905,7 +1905,7 @@ class ManagerTest extends \Test\TestCase { /** @var IShare $share */ $share = $e->getSubject(); - return $share->getShareType() === \OCP\Share::SHARE_TYPE_EMAIL && + return $share->getShareType() === IShare::TYPE_EMAIL && $share->getNode() === $path && $share->getSharedBy() === 'sharedBy' && $share->getPermissions() === \OCP\Constants::PERMISSION_ALL && @@ -1950,7 +1950,7 @@ class ManagerTest extends \Test\TestCase { $share = $this->createShare( null, - \OCP\Share::SHARE_TYPE_USER, + IShare::TYPE_USER, $path, 'sharedWith', 'sharedBy', @@ -2030,7 +2030,7 @@ class ManagerTest extends \Test\TestCase { $share = $this->createShare( null, - \OCP\Share::SHARE_TYPE_USER, + IShare::TYPE_USER, $path, 'sharedWith', 'sharedBy', @@ -2078,14 +2078,14 @@ class ManagerTest extends \Test\TestCase { ->method('getSharesBy') ->with( $this->equalTo('user'), - $this->equalTo(\OCP\Share::SHARE_TYPE_USER), + $this->equalTo(IShare::TYPE_USER), $this->equalTo($node), $this->equalTo(true), $this->equalTo(1), $this->equalTo(1) )->willReturn([$share]); - $shares = $this->manager->getSharesBy('user', \OCP\Share::SHARE_TYPE_USER, $node, true, 1, 1); + $shares = $this->manager->getSharesBy('user', IShare::TYPE_USER, $node, true, 1, 1); $this->assertCount(1, $shares); $this->assertSame($share, $shares[0]); @@ -2157,7 +2157,7 @@ class ManagerTest extends \Test\TestCase { } }); - $res = $manager->getSharesBy('user', \OCP\Share::SHARE_TYPE_LINK, $node, true, 3, 0); + $res = $manager->getSharesBy('user', IShare::TYPE_LINK, $node, true, 3, 0); $this->assertCount(3, $res); $this->assertEquals($shares[0]->getId(), $res[0]->getId()); @@ -2204,7 +2204,7 @@ class ManagerTest extends \Test\TestCase { $factory->expects($this->once()) ->method('getProviderForType') - ->with(\OCP\Share::SHARE_TYPE_LINK) + ->with(IShare::TYPE_LINK) ->willReturn($this->defaultProvider); $this->defaultProvider->expects($this->once()) @@ -2251,7 +2251,7 @@ class ManagerTest extends \Test\TestCase { $factory->expects($this->any()) ->method('getProviderForType') ->willReturnCallback(function ($shareType) use ($roomShareProvider) { - if ($shareType !== \OCP\Share::SHARE_TYPE_ROOM) { + if ($shareType !== IShare::TYPE_ROOM) { throw new Exception\ProviderException(); } @@ -2299,11 +2299,11 @@ class ManagerTest extends \Test\TestCase { $factory->expects($this->at(0)) ->method('getProviderForType') - ->with(\OCP\Share::SHARE_TYPE_LINK) + ->with(IShare::TYPE_LINK) ->willReturn($this->defaultProvider); $factory->expects($this->at(1)) ->method('getProviderForType') - ->with(\OCP\Share::SHARE_TYPE_REMOTE) + ->with(IShare::TYPE_REMOTE) ->willReturn($this->defaultProvider); $this->defaultProvider->expects($this->at(0)) @@ -2398,7 +2398,7 @@ class ManagerTest extends \Test\TestCase { ->willReturn('yes'); $share = $this->manager->newShare(); - $share->setShareType(\OCP\Share::SHARE_TYPE_LINK) + $share->setShareType(IShare::TYPE_LINK) ->setPermissions(\OCP\Constants::PERMISSION_READ | \OCP\Constants::PERMISSION_CREATE | \OCP\Constants::PERMISSION_UPDATE); $this->config @@ -2420,13 +2420,13 @@ class ManagerTest extends \Test\TestCase { public function testCheckPasswordNoLinkShare() { $share = $this->createMock(IShare::class); - $share->method('getShareType')->willReturn(\OCP\Share::SHARE_TYPE_USER); + $share->method('getShareType')->willReturn(IShare::TYPE_USER); $this->assertFalse($this->manager->checkPassword($share, 'password')); } public function testCheckPasswordNoPassword() { $share = $this->createMock(IShare::class); - $share->method('getShareType')->willReturn(\OCP\Share::SHARE_TYPE_LINK); + $share->method('getShareType')->willReturn(IShare::TYPE_LINK); $this->assertFalse($this->manager->checkPassword($share, 'password')); $share->method('getPassword')->willReturn('password'); @@ -2435,7 +2435,7 @@ class ManagerTest extends \Test\TestCase { public function testCheckPasswordInvalidPassword() { $share = $this->createMock(IShare::class); - $share->method('getShareType')->willReturn(\OCP\Share::SHARE_TYPE_LINK); + $share->method('getShareType')->willReturn(IShare::TYPE_LINK); $share->method('getPassword')->willReturn('password'); $this->hasher->method('verify')->with('invalidpassword', 'password', '')->willReturn(false); @@ -2445,7 +2445,7 @@ class ManagerTest extends \Test\TestCase { public function testCheckPasswordValidPassword() { $share = $this->createMock(IShare::class); - $share->method('getShareType')->willReturn(\OCP\Share::SHARE_TYPE_LINK); + $share->method('getShareType')->willReturn(IShare::TYPE_LINK); $share->method('getPassword')->willReturn('passwordHash'); $this->hasher->method('verify')->with('password', 'passwordHash', '')->willReturn(true); @@ -2455,7 +2455,7 @@ class ManagerTest extends \Test\TestCase { public function testCheckPasswordUpdateShare() { $share = $this->manager->newShare(); - $share->setShareType(\OCP\Share::SHARE_TYPE_LINK) + $share->setShareType(IShare::TYPE_LINK) ->setPassword('passwordHash'); $this->hasher->method('verify')->with('password', 'passwordHash', '') @@ -2487,7 +2487,7 @@ class ManagerTest extends \Test\TestCase { ->getMock(); $originalShare = $this->manager->newShare(); - $originalShare->setShareType(\OCP\Share::SHARE_TYPE_GROUP); + $originalShare->setShareType(IShare::TYPE_GROUP); $manager->expects($this->once())->method('canShare')->willReturn(true); $manager->expects($this->once())->method('getShareById')->with('foo:42')->willReturn($originalShare); @@ -2495,7 +2495,7 @@ class ManagerTest extends \Test\TestCase { $share = $this->manager->newShare(); $share->setProviderId('foo') ->setId('42') - ->setShareType(\OCP\Share::SHARE_TYPE_USER); + ->setShareType(IShare::TYPE_USER); $manager->updateShare($share); } @@ -2513,7 +2513,7 @@ class ManagerTest extends \Test\TestCase { ->getMock(); $originalShare = $this->manager->newShare(); - $originalShare->setShareType(\OCP\Share::SHARE_TYPE_GROUP) + $originalShare->setShareType(IShare::TYPE_GROUP) ->setSharedWith('origGroup'); $manager->expects($this->once())->method('canShare')->willReturn(true); @@ -2522,7 +2522,7 @@ class ManagerTest extends \Test\TestCase { $share = $this->manager->newShare(); $share->setProviderId('foo') ->setId('42') - ->setShareType(\OCP\Share::SHARE_TYPE_GROUP) + ->setShareType(IShare::TYPE_GROUP) ->setSharedWith('newGroup'); $manager->updateShare($share); @@ -2541,7 +2541,7 @@ class ManagerTest extends \Test\TestCase { ->getMock(); $originalShare = $this->manager->newShare(); - $originalShare->setShareType(\OCP\Share::SHARE_TYPE_USER) + $originalShare->setShareType(IShare::TYPE_USER) ->setSharedWith('sharedWith'); $manager->expects($this->once())->method('canShare')->willReturn(true); @@ -2550,7 +2550,7 @@ class ManagerTest extends \Test\TestCase { $share = $this->manager->newShare(); $share->setProviderId('foo') ->setId('42') - ->setShareType(\OCP\Share::SHARE_TYPE_USER) + ->setShareType(IShare::TYPE_USER) ->setSharedWith('newUser') ->setShareOwner('newUser'); @@ -2571,7 +2571,7 @@ class ManagerTest extends \Test\TestCase { ->getMock(); $originalShare = $this->manager->newShare(); - $originalShare->setShareType(\OCP\Share::SHARE_TYPE_USER) + $originalShare->setShareType(IShare::TYPE_USER) ->setSharedWith('origUser') ->setPermissions(1); @@ -2585,7 +2585,7 @@ class ManagerTest extends \Test\TestCase { $share = $this->manager->newShare(); $share->setProviderId('foo') ->setId('42') - ->setShareType(\OCP\Share::SHARE_TYPE_USER) + ->setShareType(IShare::TYPE_USER) ->setSharedWith('origUser') ->setShareOwner('newUser') ->setSharedBy('sharer') @@ -2609,7 +2609,7 @@ class ManagerTest extends \Test\TestCase { $hookListner2->expects($this->once())->method('post')->with([ 'itemType' => 'file', 'itemSource' => 100, - 'shareType' => \OCP\Share::SHARE_TYPE_USER, + 'shareType' => IShare::TYPE_USER, 'shareWith' => 'origUser', 'uidOwner' => 'sharer', 'permissions' => 31, @@ -2631,7 +2631,7 @@ class ManagerTest extends \Test\TestCase { ->getMock(); $originalShare = $this->manager->newShare(); - $originalShare->setShareType(\OCP\Share::SHARE_TYPE_GROUP) + $originalShare->setShareType(IShare::TYPE_GROUP) ->setSharedWith('origUser') ->setPermissions(31); @@ -2643,7 +2643,7 @@ class ManagerTest extends \Test\TestCase { $share = $this->manager->newShare(); $share->setProviderId('foo') ->setId('42') - ->setShareType(\OCP\Share::SHARE_TYPE_GROUP) + ->setShareType(IShare::TYPE_GROUP) ->setSharedWith('origUser') ->setShareOwner('owner') ->setNode($node) @@ -2679,7 +2679,7 @@ class ManagerTest extends \Test\TestCase { ->getMock(); $originalShare = $this->manager->newShare(); - $originalShare->setShareType(\OCP\Share::SHARE_TYPE_LINK) + $originalShare->setShareType(IShare::TYPE_LINK) ->setPermissions(15); $tomorrow = new \DateTime(); @@ -2692,7 +2692,7 @@ class ManagerTest extends \Test\TestCase { $share = $this->manager->newShare(); $share->setProviderId('foo') ->setId('42') - ->setShareType(\OCP\Share::SHARE_TYPE_LINK) + ->setShareType(IShare::TYPE_LINK) ->setToken('token') ->setSharedBy('owner') ->setShareOwner('owner') @@ -2760,7 +2760,7 @@ class ManagerTest extends \Test\TestCase { ->getMock(); $originalShare = $this->manager->newShare(); - $originalShare->setShareType(\OCP\Share::SHARE_TYPE_LINK) + $originalShare->setShareType(IShare::TYPE_LINK) ->setPermissions(15); $tomorrow = new \DateTime(); @@ -2773,7 +2773,7 @@ class ManagerTest extends \Test\TestCase { $share = $this->manager->newShare(); $share->setProviderId('foo') ->setId('42') - ->setShareType(\OCP\Share::SHARE_TYPE_LINK) + ->setShareType(IShare::TYPE_LINK) ->setToken('token') ->setSharedBy('owner') ->setShareOwner('owner') @@ -2826,7 +2826,7 @@ class ManagerTest extends \Test\TestCase { ->getMock(); $originalShare = $this->manager->newShare(); - $originalShare->setShareType(\OCP\Share::SHARE_TYPE_EMAIL) + $originalShare->setShareType(IShare::TYPE_EMAIL) ->setPermissions(\OCP\Constants::PERMISSION_ALL); $tomorrow = new \DateTime(); @@ -2839,7 +2839,7 @@ class ManagerTest extends \Test\TestCase { $share = $this->manager->newShare(); $share->setProviderId('foo') ->setId('42') - ->setShareType(\OCP\Share::SHARE_TYPE_EMAIL) + ->setShareType(IShare::TYPE_EMAIL) ->setToken('token') ->setSharedBy('owner') ->setShareOwner('owner') @@ -2901,7 +2901,7 @@ class ManagerTest extends \Test\TestCase { ->getMock(); $originalShare = $this->manager->newShare(); - $originalShare->setShareType(\OCP\Share::SHARE_TYPE_EMAIL) + $originalShare->setShareType(IShare::TYPE_EMAIL) ->setPermissions(\OCP\Constants::PERMISSION_ALL) ->setPassword(null) ->setSendPasswordByTalk(false); @@ -2916,7 +2916,7 @@ class ManagerTest extends \Test\TestCase { $share = $this->manager->newShare(); $share->setProviderId('foo') ->setId('42') - ->setShareType(\OCP\Share::SHARE_TYPE_EMAIL) + ->setShareType(IShare::TYPE_EMAIL) ->setToken('token') ->setSharedBy('owner') ->setShareOwner('owner') @@ -2979,7 +2979,7 @@ class ManagerTest extends \Test\TestCase { ->getMock(); $originalShare = $this->manager->newShare(); - $originalShare->setShareType(\OCP\Share::SHARE_TYPE_EMAIL) + $originalShare->setShareType(IShare::TYPE_EMAIL) ->setPermissions(\OCP\Constants::PERMISSION_ALL) ->setPassword('anotherPasswordHash') ->setSendPasswordByTalk(false); @@ -2994,7 +2994,7 @@ class ManagerTest extends \Test\TestCase { $share = $this->manager->newShare(); $share->setProviderId('foo') ->setId('42') - ->setShareType(\OCP\Share::SHARE_TYPE_EMAIL) + ->setShareType(IShare::TYPE_EMAIL) ->setToken('token') ->setSharedBy('owner') ->setShareOwner('owner') @@ -3065,7 +3065,7 @@ class ManagerTest extends \Test\TestCase { ->getMock(); $originalShare = $this->manager->newShare(); - $originalShare->setShareType(\OCP\Share::SHARE_TYPE_EMAIL) + $originalShare->setShareType(IShare::TYPE_EMAIL) ->setPermissions(\OCP\Constants::PERMISSION_ALL) ->setPassword(null) ->setSendPasswordByTalk(false); @@ -3080,7 +3080,7 @@ class ManagerTest extends \Test\TestCase { $share = $this->manager->newShare(); $share->setProviderId('foo') ->setId('42') - ->setShareType(\OCP\Share::SHARE_TYPE_EMAIL) + ->setShareType(IShare::TYPE_EMAIL) ->setToken('token') ->setSharedBy('owner') ->setShareOwner('owner') @@ -3137,7 +3137,7 @@ class ManagerTest extends \Test\TestCase { ->getMock(); $originalShare = $this->manager->newShare(); - $originalShare->setShareType(\OCP\Share::SHARE_TYPE_EMAIL) + $originalShare->setShareType(IShare::TYPE_EMAIL) ->setPermissions(\OCP\Constants::PERMISSION_ALL) ->setPassword('passwordHash') ->setSendPasswordByTalk(false); @@ -3152,7 +3152,7 @@ class ManagerTest extends \Test\TestCase { $share = $this->manager->newShare(); $share->setProviderId('foo') ->setId('42') - ->setShareType(\OCP\Share::SHARE_TYPE_EMAIL) + ->setShareType(IShare::TYPE_EMAIL) ->setToken('token') ->setSharedBy('owner') ->setShareOwner('owner') @@ -3209,7 +3209,7 @@ class ManagerTest extends \Test\TestCase { ->getMock(); $originalShare = $this->manager->newShare(); - $originalShare->setShareType(\OCP\Share::SHARE_TYPE_EMAIL) + $originalShare->setShareType(IShare::TYPE_EMAIL) ->setPermissions(\OCP\Constants::PERMISSION_ALL) ->setPassword('passwordHash') ->setSendPasswordByTalk(false); @@ -3224,7 +3224,7 @@ class ManagerTest extends \Test\TestCase { $share = $this->manager->newShare(); $share->setProviderId('foo') ->setId('42') - ->setShareType(\OCP\Share::SHARE_TYPE_EMAIL) + ->setShareType(IShare::TYPE_EMAIL) ->setToken('token') ->setSharedBy('owner') ->setShareOwner('owner') @@ -3281,7 +3281,7 @@ class ManagerTest extends \Test\TestCase { ->getMock(); $originalShare = $this->manager->newShare(); - $originalShare->setShareType(\OCP\Share::SHARE_TYPE_EMAIL) + $originalShare->setShareType(IShare::TYPE_EMAIL) ->setPermissions(\OCP\Constants::PERMISSION_ALL) ->setPassword('passwordHash') ->setSendPasswordByTalk(false); @@ -3296,7 +3296,7 @@ class ManagerTest extends \Test\TestCase { $share = $this->manager->newShare(); $share->setProviderId('foo') ->setId('42') - ->setShareType(\OCP\Share::SHARE_TYPE_EMAIL) + ->setShareType(IShare::TYPE_EMAIL) ->setToken('token') ->setSharedBy('owner') ->setShareOwner('owner') @@ -3357,7 +3357,7 @@ class ManagerTest extends \Test\TestCase { ->getMock(); $originalShare = $this->manager->newShare(); - $originalShare->setShareType(\OCP\Share::SHARE_TYPE_EMAIL) + $originalShare->setShareType(IShare::TYPE_EMAIL) ->setPermissions(\OCP\Constants::PERMISSION_ALL) ->setPassword('passwordHash') ->setSendPasswordByTalk(true); @@ -3372,7 +3372,7 @@ class ManagerTest extends \Test\TestCase { $share = $this->manager->newShare(); $share->setProviderId('foo') ->setId('42') - ->setShareType(\OCP\Share::SHARE_TYPE_EMAIL) + ->setShareType(IShare::TYPE_EMAIL) ->setToken('token') ->setSharedBy('owner') ->setShareOwner('owner') @@ -3433,7 +3433,7 @@ class ManagerTest extends \Test\TestCase { ->getMock(); $originalShare = $this->manager->newShare(); - $originalShare->setShareType(\OCP\Share::SHARE_TYPE_EMAIL) + $originalShare->setShareType(IShare::TYPE_EMAIL) ->setPermissions(\OCP\Constants::PERMISSION_ALL) ->setPassword('passwordHash') ->setSendPasswordByTalk(true); @@ -3448,7 +3448,7 @@ class ManagerTest extends \Test\TestCase { $share = $this->manager->newShare(); $share->setProviderId('foo') ->setId('42') - ->setShareType(\OCP\Share::SHARE_TYPE_EMAIL) + ->setShareType(IShare::TYPE_EMAIL) ->setToken('token') ->setSharedBy('owner') ->setShareOwner('owner') @@ -3495,7 +3495,7 @@ class ManagerTest extends \Test\TestCase { $this->expectExceptionMessage('Can’t change target of link share'); $share = $this->manager->newShare(); - $share->setShareType(\OCP\Share::SHARE_TYPE_LINK); + $share->setShareType(IShare::TYPE_LINK); $recipient = $this->createMock(IUser::class); @@ -3508,7 +3508,7 @@ class ManagerTest extends \Test\TestCase { $this->expectExceptionMessage('Invalid recipient'); $share = $this->manager->newShare(); - $share->setShareType(\OCP\Share::SHARE_TYPE_USER); + $share->setShareType(IShare::TYPE_USER); $share->setSharedWith('sharedWith'); @@ -3517,7 +3517,7 @@ class ManagerTest extends \Test\TestCase { public function testMoveShareUser() { $share = $this->manager->newShare(); - $share->setShareType(\OCP\Share::SHARE_TYPE_USER) + $share->setShareType(IShare::TYPE_USER) ->setId('42') ->setProviderId('foo'); @@ -3535,7 +3535,7 @@ class ManagerTest extends \Test\TestCase { $this->expectExceptionMessage('Invalid recipient'); $share = $this->manager->newShare(); - $share->setShareType(\OCP\Share::SHARE_TYPE_GROUP); + $share->setShareType(IShare::TYPE_GROUP); $sharedWith = $this->createMock(IGroup::class); $share->setSharedWith('shareWith'); @@ -3555,7 +3555,7 @@ class ManagerTest extends \Test\TestCase { $this->expectExceptionMessage('Group "shareWith" does not exist'); $share = $this->manager->newShare(); - $share->setShareType(\OCP\Share::SHARE_TYPE_GROUP); + $share->setShareType(IShare::TYPE_GROUP); $share->setSharedWith('shareWith'); $recipient = $this->createMock(IUser::class); @@ -3568,7 +3568,7 @@ class ManagerTest extends \Test\TestCase { public function testMoveShareGroup() { $share = $this->manager->newShare(); - $share->setShareType(\OCP\Share::SHARE_TYPE_GROUP) + $share->setShareType(IShare::TYPE_GROUP) ->setId('42') ->setProviderId('foo'); @@ -3594,7 +3594,7 @@ class ManagerTest extends \Test\TestCase { $factory = $this->getMockBuilder('OCP\Share\IProviderFactory')->getMock(); $factory->expects($this->any())->method('getProviderForType') ->willReturnCallback(function ($id) { - if ($id === \OCP\Share::SHARE_TYPE_USER) { + if ($id === IShare::TYPE_USER) { return true; } throw new Exception\ProviderException(); @@ -3625,7 +3625,7 @@ class ManagerTest extends \Test\TestCase { public function dataTestShareProviderExists() { return [ - [\OCP\Share::SHARE_TYPE_USER, true], + [IShare::TYPE_USER, true], [42, false], ]; } |