aboutsummaryrefslogtreecommitdiffstats
path: root/tests/lib
diff options
context:
space:
mode:
authorJoas Schilling <coding@schilljs.com>2020-06-24 16:49:16 +0200
committerJoas Schilling <coding@schilljs.com>2020-06-24 16:49:16 +0200
commit89ed2c37bf656ceb772bb6759c8977a7dc78b3fb (patch)
tree4a467f829fcc748531cad54e7c08e06dd98d1b7d /tests/lib
parent654cd18864c943d9ff93c2e6151bb6529fa44513 (diff)
downloadnextcloud-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')
-rw-r--r--tests/lib/Collaboration/Collaborators/GroupPluginTest.php54
-rw-r--r--tests/lib/Collaboration/Collaborators/LookupPluginTest.php32
-rw-r--r--tests/lib/Collaboration/Collaborators/MailPluginTest.php32
-rw-r--r--tests/lib/Collaboration/Collaborators/RemotePluginTest.php20
-rw-r--r--tests/lib/Collaboration/Collaborators/SearchTest.php46
-rw-r--r--tests/lib/Collaboration/Collaborators/UserPluginTest.php36
-rw-r--r--tests/lib/DB/schemDiffData/core.xml2
-rw-r--r--tests/lib/Files/ViewTest.php10
-rw-r--r--tests/lib/Repair/OldGroupMembershipSharesTest.php8
-rw-r--r--tests/lib/Repair/RepairInvalidSharesTest.php6
-rw-r--r--tests/lib/Share/ShareTest.php20
-rw-r--r--tests/lib/Share20/DefaultShareProviderTest.php244
-rw-r--r--tests/lib/Share20/LegacyHooksTest.php29
-rw-r--r--tests/lib/Share20/ManagerTest.php246
-rw-r--r--tests/lib/TagsTest.php3
15 files changed, 395 insertions, 393 deletions
diff --git a/tests/lib/Collaboration/Collaborators/GroupPluginTest.php b/tests/lib/Collaboration/Collaborators/GroupPluginTest.php
index 909a11596a3..3f9e0900d15 100644
--- a/tests/lib/Collaboration/Collaborators/GroupPluginTest.php
+++ b/tests/lib/Collaboration/Collaborators/GroupPluginTest.php
@@ -31,7 +31,7 @@ use OCP\IGroup;
use OCP\IGroupManager;
use OCP\IUser;
use OCP\IUserSession;
-use OCP\Share;
+use OCP\Share\IShare;
use Test\TestCase;
class GroupPluginTest extends TestCase {
@@ -135,7 +135,7 @@ class GroupPluginTest extends TestCase {
[$this->getGroupMock('test1')],
[],
[],
- [['label' => 'test1', 'value' => ['shareType' => Share::SHARE_TYPE_GROUP, 'shareWith' => 'test1']]],
+ [['label' => 'test1', 'value' => ['shareType' => IShare::TYPE_GROUP, 'shareWith' => 'test1']]],
true,
false,
],
@@ -145,7 +145,7 @@ class GroupPluginTest extends TestCase {
[$this->getGroupMock('test1', 'Test One')],
[],
[],
- [['label' => 'Test One', 'value' => ['shareType' => Share::SHARE_TYPE_GROUP, 'shareWith' => 'test1']]],
+ [['label' => 'Test One', 'value' => ['shareType' => IShare::TYPE_GROUP, 'shareWith' => 'test1']]],
true,
false,
],
@@ -155,7 +155,7 @@ class GroupPluginTest extends TestCase {
[$this->getGroupMock('test1', 'Test One')],
[],
[],
- [['label' => 'Test One', 'value' => ['shareType' => Share::SHARE_TYPE_GROUP, 'shareWith' => 'test1']]],
+ [['label' => 'Test One', 'value' => ['shareType' => IShare::TYPE_GROUP, 'shareWith' => 'test1']]],
true,
false,
],
@@ -164,7 +164,7 @@ class GroupPluginTest extends TestCase {
'Test One', false, true,
[$this->getGroupMock('test1', 'Test One')],
[],
- [['label' => 'Test One', 'value' => ['shareType' => Share::SHARE_TYPE_GROUP, 'shareWith' => 'test1']]],
+ [['label' => 'Test One', 'value' => ['shareType' => IShare::TYPE_GROUP, 'shareWith' => 'test1']]],
[],
true,
false,
@@ -185,8 +185,8 @@ class GroupPluginTest extends TestCase {
$this->getGroupMock('test1'),
],
[],
- [['label' => 'test', 'value' => ['shareType' => Share::SHARE_TYPE_GROUP, 'shareWith' => 'test']]],
- [['label' => 'test1', 'value' => ['shareType' => Share::SHARE_TYPE_GROUP, 'shareWith' => 'test1']]],
+ [['label' => 'test', 'value' => ['shareType' => IShare::TYPE_GROUP, 'shareWith' => 'test']]],
+ [['label' => 'test1', 'value' => ['shareType' => IShare::TYPE_GROUP, 'shareWith' => 'test1']]],
false,
false,
],
@@ -197,7 +197,7 @@ class GroupPluginTest extends TestCase {
$this->getGroupMock('test1'),
],
[],
- [['label' => 'test', 'value' => ['shareType' => Share::SHARE_TYPE_GROUP, 'shareWith' => 'test']]],
+ [['label' => 'test', 'value' => ['shareType' => IShare::TYPE_GROUP, 'shareWith' => 'test']]],
[],
true,
false,
@@ -211,8 +211,8 @@ class GroupPluginTest extends TestCase {
[],
[],
[
- ['label' => 'test0', 'value' => ['shareType' => Share::SHARE_TYPE_GROUP, 'shareWith' => 'test0']],
- ['label' => 'test1', 'value' => ['shareType' => Share::SHARE_TYPE_GROUP, 'shareWith' => 'test1']],
+ ['label' => 'test0', 'value' => ['shareType' => IShare::TYPE_GROUP, 'shareWith' => 'test0']],
+ ['label' => 'test1', 'value' => ['shareType' => IShare::TYPE_GROUP, 'shareWith' => 'test1']],
],
false,
null,
@@ -237,11 +237,11 @@ class GroupPluginTest extends TestCase {
],
[],
[
- ['label' => 'test', 'value' => ['shareType' => Share::SHARE_TYPE_GROUP, 'shareWith' => 'test']],
+ ['label' => 'test', 'value' => ['shareType' => IShare::TYPE_GROUP, 'shareWith' => 'test']],
],
[
- ['label' => 'test0', 'value' => ['shareType' => Share::SHARE_TYPE_GROUP, 'shareWith' => 'test0']],
- ['label' => 'test1', 'value' => ['shareType' => Share::SHARE_TYPE_GROUP, 'shareWith' => 'test1']],
+ ['label' => 'test0', 'value' => ['shareType' => IShare::TYPE_GROUP, 'shareWith' => 'test0']],
+ ['label' => 'test1', 'value' => ['shareType' => IShare::TYPE_GROUP, 'shareWith' => 'test1']],
],
false,
$this->getGroupMock('test'),
@@ -254,7 +254,7 @@ class GroupPluginTest extends TestCase {
],
[],
[
- ['label' => 'test', 'value' => ['shareType' => Share::SHARE_TYPE_GROUP, 'shareWith' => 'test']],
+ ['label' => 'test', 'value' => ['shareType' => IShare::TYPE_GROUP, 'shareWith' => 'test']],
],
[],
true,
@@ -270,7 +270,7 @@ class GroupPluginTest extends TestCase {
],
[$this->getGroupMock('test1')],
[],
- [['label' => 'test1', 'value' => ['shareType' => Share::SHARE_TYPE_GROUP, 'shareWith' => 'test1']]],
+ [['label' => 'test1', 'value' => ['shareType' => IShare::TYPE_GROUP, 'shareWith' => 'test1']]],
false,
false,
],
@@ -293,7 +293,7 @@ class GroupPluginTest extends TestCase {
$this->getGroupMock('test1'),
],
[$this->getGroupMock('test')],
- [['label' => 'test', 'value' => ['shareType' => Share::SHARE_TYPE_GROUP, 'shareWith' => 'test']]],
+ [['label' => 'test', 'value' => ['shareType' => IShare::TYPE_GROUP, 'shareWith' => 'test']]],
[],
false,
false,
@@ -305,7 +305,7 @@ class GroupPluginTest extends TestCase {
$this->getGroupMock('test1'),
],
[$this->getGroupMock('test')],
- [['label' => 'test', 'value' => ['shareType' => Share::SHARE_TYPE_GROUP, 'shareWith' => 'test']]],
+ [['label' => 'test', 'value' => ['shareType' => IShare::TYPE_GROUP, 'shareWith' => 'test']]],
[],
true,
false,
@@ -318,7 +318,7 @@ class GroupPluginTest extends TestCase {
],
[$this->getGroupMock('test1')],
[],
- [['label' => 'test1', 'value' => ['shareType' => Share::SHARE_TYPE_GROUP, 'shareWith' => 'test1']]],
+ [['label' => 'test1', 'value' => ['shareType' => IShare::TYPE_GROUP, 'shareWith' => 'test1']]],
false,
false,
],
@@ -341,8 +341,8 @@ class GroupPluginTest extends TestCase {
$this->getGroupMock('test1'),
],
[$this->getGroupMock('test'), $this->getGroupMock('test0'), $this->getGroupMock('test1')],
- [['label' => 'test', 'value' => ['shareType' => Share::SHARE_TYPE_GROUP, 'shareWith' => 'test']]],
- [['label' => 'test1', 'value' => ['shareType' => Share::SHARE_TYPE_GROUP, 'shareWith' => 'test1']]],
+ [['label' => 'test', 'value' => ['shareType' => IShare::TYPE_GROUP, 'shareWith' => 'test']]],
+ [['label' => 'test1', 'value' => ['shareType' => IShare::TYPE_GROUP, 'shareWith' => 'test1']]],
false,
false,
],
@@ -353,7 +353,7 @@ class GroupPluginTest extends TestCase {
$this->getGroupMock('test1'),
],
[$this->getGroupMock('test'), $this->getGroupMock('test0'), $this->getGroupMock('test1')],
- [['label' => 'test', 'value' => ['shareType' => Share::SHARE_TYPE_GROUP, 'shareWith' => 'test']]],
+ [['label' => 'test', 'value' => ['shareType' => IShare::TYPE_GROUP, 'shareWith' => 'test']]],
[],
true,
false,
@@ -367,8 +367,8 @@ class GroupPluginTest extends TestCase {
[$this->getGroupMock('test'), $this->getGroupMock('test0'), $this->getGroupMock('test1')],
[],
[
- ['label' => 'test0', 'value' => ['shareType' => Share::SHARE_TYPE_GROUP, 'shareWith' => 'test0']],
- ['label' => 'test1', 'value' => ['shareType' => Share::SHARE_TYPE_GROUP, 'shareWith' => 'test1']],
+ ['label' => 'test0', 'value' => ['shareType' => IShare::TYPE_GROUP, 'shareWith' => 'test0']],
+ ['label' => 'test1', 'value' => ['shareType' => IShare::TYPE_GROUP, 'shareWith' => 'test1']],
],
false,
null,
@@ -393,11 +393,11 @@ class GroupPluginTest extends TestCase {
],
[$this->getGroupMock('test'), $this->getGroupMock('test0'), $this->getGroupMock('test1')],
[
- ['label' => 'test', 'value' => ['shareType' => Share::SHARE_TYPE_GROUP, 'shareWith' => 'test']],
+ ['label' => 'test', 'value' => ['shareType' => IShare::TYPE_GROUP, 'shareWith' => 'test']],
],
[
- ['label' => 'test0', 'value' => ['shareType' => Share::SHARE_TYPE_GROUP, 'shareWith' => 'test0']],
- ['label' => 'test1', 'value' => ['shareType' => Share::SHARE_TYPE_GROUP, 'shareWith' => 'test1']],
+ ['label' => 'test0', 'value' => ['shareType' => IShare::TYPE_GROUP, 'shareWith' => 'test0']],
+ ['label' => 'test1', 'value' => ['shareType' => IShare::TYPE_GROUP, 'shareWith' => 'test1']],
],
false,
$this->getGroupMock('test'),
@@ -410,7 +410,7 @@ class GroupPluginTest extends TestCase {
],
[$this->getGroupMock('test'), $this->getGroupMock('test0'), $this->getGroupMock('test1')],
[
- ['label' => 'test', 'value' => ['shareType' => Share::SHARE_TYPE_GROUP, 'shareWith' => 'test']],
+ ['label' => 'test', 'value' => ['shareType' => IShare::TYPE_GROUP, 'shareWith' => 'test']],
],
[],
true,
diff --git a/tests/lib/Collaboration/Collaborators/LookupPluginTest.php b/tests/lib/Collaboration/Collaborators/LookupPluginTest.php
index eb26443a269..383dd0c39a2 100644
--- a/tests/lib/Collaboration/Collaborators/LookupPluginTest.php
+++ b/tests/lib/Collaboration/Collaborators/LookupPluginTest.php
@@ -36,7 +36,7 @@ use OCP\IConfig;
use OCP\ILogger;
use OCP\IUser;
use OCP\IUserSession;
-use OCP\Share;
+use OCP\Share\IShare;
use Test\TestCase;
class LookupPluginTest extends TestCase {
@@ -301,7 +301,7 @@ class LookupPluginTest extends TestCase {
[
'label' => $fedIDs[0],
'value' => [
- 'shareType' => Share::SHARE_TYPE_REMOTE,
+ 'shareType' => IShare::TYPE_REMOTE,
'shareWith' => $fedIDs[0]
],
'extra' => ['federationId' => $fedIDs[0]],
@@ -309,7 +309,7 @@ class LookupPluginTest extends TestCase {
[
'label' => $fedIDs[1],
'value' => [
- 'shareType' => Share::SHARE_TYPE_REMOTE,
+ 'shareType' => IShare::TYPE_REMOTE,
'shareWith' => $fedIDs[1]
],
'extra' => ['federationId' => $fedIDs[1]],
@@ -317,7 +317,7 @@ class LookupPluginTest extends TestCase {
[
'label' => $fedIDs[2],
'value' => [
- 'shareType' => Share::SHARE_TYPE_REMOTE,
+ 'shareType' => IShare::TYPE_REMOTE,
'shareWith' => $fedIDs[2]
],
'extra' => ['federationId' => $fedIDs[2]],
@@ -340,7 +340,7 @@ class LookupPluginTest extends TestCase {
[
'label' => $fedIDs[0],
'value' => [
- 'shareType' => Share::SHARE_TYPE_REMOTE,
+ 'shareType' => IShare::TYPE_REMOTE,
'shareWith' => $fedIDs[0]
],
'extra' => ['federationId' => $fedIDs[0]],
@@ -348,7 +348,7 @@ class LookupPluginTest extends TestCase {
[
'label' => $fedIDs[1],
'value' => [
- 'shareType' => Share::SHARE_TYPE_REMOTE,
+ 'shareType' => IShare::TYPE_REMOTE,
'shareWith' => $fedIDs[1]
],
'extra' => ['federationId' => $fedIDs[1]],
@@ -356,7 +356,7 @@ class LookupPluginTest extends TestCase {
[
'label' => $fedIDs[2],
'value' => [
- 'shareType' => Share::SHARE_TYPE_REMOTE,
+ 'shareType' => IShare::TYPE_REMOTE,
'shareWith' => $fedIDs[2]
],
'extra' => ['federationId' => $fedIDs[2]],
@@ -379,7 +379,7 @@ class LookupPluginTest extends TestCase {
[
'label' => $fedIDs[0],
'value' => [
- 'shareType' => Share::SHARE_TYPE_REMOTE,
+ 'shareType' => IShare::TYPE_REMOTE,
'shareWith' => $fedIDs[0]
],
'extra' => ['federationId' => $fedIDs[0]],
@@ -387,7 +387,7 @@ class LookupPluginTest extends TestCase {
[
'label' => $fedIDs[1],
'value' => [
- 'shareType' => Share::SHARE_TYPE_REMOTE,
+ 'shareType' => IShare::TYPE_REMOTE,
'shareWith' => $fedIDs[1]
],
'extra' => ['federationId' => $fedIDs[1]],
@@ -395,7 +395,7 @@ class LookupPluginTest extends TestCase {
[
'label' => $fedIDs[2],
'value' => [
- 'shareType' => Share::SHARE_TYPE_REMOTE,
+ 'shareType' => IShare::TYPE_REMOTE,
'shareWith' => $fedIDs[2]
],
'extra' => ['federationId' => $fedIDs[2]],
@@ -418,7 +418,7 @@ class LookupPluginTest extends TestCase {
[
'label' => $fedIDs[0],
'value' => [
- 'shareType' => Share::SHARE_TYPE_REMOTE,
+ 'shareType' => IShare::TYPE_REMOTE,
'shareWith' => $fedIDs[0]
],
'extra' => ['federationId' => $fedIDs[0]],
@@ -426,7 +426,7 @@ class LookupPluginTest extends TestCase {
[
'label' => $fedIDs[1],
'value' => [
- 'shareType' => Share::SHARE_TYPE_REMOTE,
+ 'shareType' => IShare::TYPE_REMOTE,
'shareWith' => $fedIDs[1]
],
'extra' => ['federationId' => $fedIDs[1]],
@@ -434,7 +434,7 @@ class LookupPluginTest extends TestCase {
[
'label' => $fedIDs[2],
'value' => [
- 'shareType' => Share::SHARE_TYPE_REMOTE,
+ 'shareType' => IShare::TYPE_REMOTE,
'shareWith' => $fedIDs[2]
],
'extra' => ['federationId' => $fedIDs[2]],
@@ -469,7 +469,7 @@ class LookupPluginTest extends TestCase {
[
'label' => $fedIDs[0],
'value' => [
- 'shareType' => Share::SHARE_TYPE_REMOTE,
+ 'shareType' => IShare::TYPE_REMOTE,
'shareWith' => $fedIDs[0]
],
'extra' => ['federationId' => $fedIDs[0]],
@@ -477,7 +477,7 @@ class LookupPluginTest extends TestCase {
[
'label' => $fedIDs[1],
'value' => [
- 'shareType' => Share::SHARE_TYPE_REMOTE,
+ 'shareType' => IShare::TYPE_REMOTE,
'shareWith' => $fedIDs[1]
],
'extra' => ['federationId' => $fedIDs[1]],
@@ -485,7 +485,7 @@ class LookupPluginTest extends TestCase {
[
'label' => $fedIDs[2],
'value' => [
- 'shareType' => Share::SHARE_TYPE_REMOTE,
+ 'shareType' => IShare::TYPE_REMOTE,
'shareWith' => $fedIDs[2]
],
'extra' => ['federationId' => $fedIDs[2]],
diff --git a/tests/lib/Collaboration/Collaborators/MailPluginTest.php b/tests/lib/Collaboration/Collaborators/MailPluginTest.php
index 613208d27b1..6e859b55358 100644
--- a/tests/lib/Collaboration/Collaborators/MailPluginTest.php
+++ b/tests/lib/Collaboration/Collaborators/MailPluginTest.php
@@ -33,7 +33,7 @@ use OCP\IConfig;
use OCP\IGroupManager;
use OCP\IUser;
use OCP\IUserSession;
-use OCP\Share;
+use OCP\Share\IShare;
use Test\TestCase;
class MailPluginTest extends TestCase {
@@ -126,7 +126,7 @@ class MailPluginTest extends TestCase {
'test@remote.com',
[],
true,
- ['emails' => [], 'exact' => ['emails' => [['uuid' => 'test@remote.com', 'label' => 'test@remote.com', 'value' => ['shareType' => Share::SHARE_TYPE_EMAIL, 'shareWith' => 'test@remote.com']]]]],
+ ['emails' => [], 'exact' => ['emails' => [['uuid' => 'test@remote.com', 'label' => 'test@remote.com', 'value' => ['shareType' => IShare::TYPE_EMAIL, 'shareWith' => 'test@remote.com']]]]],
false,
false,
],
@@ -144,7 +144,7 @@ class MailPluginTest extends TestCase {
'test@remote.com',
[],
false,
- ['emails' => [], 'exact' => ['emails' => [['uuid' => 'test@remote.com', 'label' => 'test@remote.com', 'value' => ['shareType' => Share::SHARE_TYPE_EMAIL, 'shareWith' => 'test@remote.com']]]]],
+ ['emails' => [], 'exact' => ['emails' => [['uuid' => 'test@remote.com', 'label' => 'test@remote.com', 'value' => ['shareType' => IShare::TYPE_EMAIL, 'shareWith' => 'test@remote.com']]]]],
false,
false,
],
@@ -171,7 +171,7 @@ class MailPluginTest extends TestCase {
],
],
true,
- ['emails' => [['uuid' => 'uid1', 'name' => 'User @ Localhost', 'type' => '', 'label' => 'User @ Localhost (username@localhost)', 'value' => ['shareType' => Share::SHARE_TYPE_EMAIL, 'shareWith' => 'username@localhost']]], 'exact' => ['emails' => []]],
+ ['emails' => [['uuid' => 'uid1', 'name' => 'User @ Localhost', 'type' => '', 'label' => 'User @ Localhost (username@localhost)', 'value' => ['shareType' => IShare::TYPE_EMAIL, 'shareWith' => 'username@localhost']]], 'exact' => ['emails' => []]],
false,
false,
],
@@ -225,7 +225,7 @@ class MailPluginTest extends TestCase {
],
],
true,
- ['emails' => [['uuid' => 'uid1', 'name' => 'User @ Localhost', 'type' => '', 'label' => 'User @ Localhost (username@localhost)', 'value' => ['shareType' => Share::SHARE_TYPE_EMAIL, 'shareWith' => 'username@localhost']]], 'exact' => ['emails' => [['label' => 'test@remote.com', 'uuid' => 'test@remote.com', 'value' => ['shareType' => Share::SHARE_TYPE_EMAIL, 'shareWith' => 'test@remote.com']]]]],
+ ['emails' => [['uuid' => 'uid1', 'name' => 'User @ Localhost', 'type' => '', 'label' => 'User @ Localhost (username@localhost)', 'value' => ['shareType' => IShare::TYPE_EMAIL, 'shareWith' => 'username@localhost']]], 'exact' => ['emails' => [['label' => 'test@remote.com', 'uuid' => 'test@remote.com', 'value' => ['shareType' => IShare::TYPE_EMAIL, 'shareWith' => 'test@remote.com']]]]],
false,
false,
],
@@ -252,7 +252,7 @@ class MailPluginTest extends TestCase {
],
],
false,
- ['emails' => [], 'exact' => ['emails' => [['label' => 'test@remote.com', 'uuid' => 'test@remote.com', 'value' => ['shareType' => Share::SHARE_TYPE_EMAIL, 'shareWith' => 'test@remote.com']]]]],
+ ['emails' => [], 'exact' => ['emails' => [['label' => 'test@remote.com', 'uuid' => 'test@remote.com', 'value' => ['shareType' => IShare::TYPE_EMAIL, 'shareWith' => 'test@remote.com']]]]],
false,
false,
],
@@ -279,7 +279,7 @@ class MailPluginTest extends TestCase {
],
],
true,
- ['emails' => [], 'exact' => ['emails' => [['name' => 'User @ Localhost', 'uuid' => 'uid1', 'type' => '', 'label' => 'User @ Localhost (username@localhost)', 'value' => ['shareType' => Share::SHARE_TYPE_EMAIL, 'shareWith' => 'username@localhost']]]]],
+ ['emails' => [], 'exact' => ['emails' => [['name' => 'User @ Localhost', 'uuid' => 'uid1', 'type' => '', 'label' => 'User @ Localhost (username@localhost)', 'value' => ['shareType' => IShare::TYPE_EMAIL, 'shareWith' => 'username@localhost']]]]],
true,
false,
],
@@ -306,7 +306,7 @@ class MailPluginTest extends TestCase {
],
],
false,
- ['emails' => [], 'exact' => ['emails' => [['name' => 'User @ Localhost', 'uuid' => 'uid1', 'type' => '', 'label' => 'User @ Localhost (username@localhost)', 'value' => ['shareType' => Share::SHARE_TYPE_EMAIL, 'shareWith' => 'username@localhost']]]]],
+ ['emails' => [], 'exact' => ['emails' => [['name' => 'User @ Localhost', 'uuid' => 'uid1', 'type' => '', 'label' => 'User @ Localhost (username@localhost)', 'value' => ['shareType' => IShare::TYPE_EMAIL, 'shareWith' => 'username@localhost']]]]],
true,
false,
],
@@ -334,7 +334,7 @@ class MailPluginTest extends TestCase {
],
],
false,
- ['emails' => [], 'exact' => ['emails' => [['name' => 'User Name @ Localhost', 'uuid' => 'uid1', 'type' => '', 'label' => 'User Name @ Localhost (user name@localhost)', 'value' => ['shareType' => Share::SHARE_TYPE_EMAIL, 'shareWith' => 'user name@localhost']]]]],
+ ['emails' => [], 'exact' => ['emails' => [['name' => 'User Name @ Localhost', 'uuid' => 'uid1', 'type' => '', 'label' => 'User Name @ Localhost (user name@localhost)', 'value' => ['shareType' => IShare::TYPE_EMAIL, 'shareWith' => 'user name@localhost']]]]],
true,
false,
],
@@ -380,7 +380,7 @@ class MailPluginTest extends TestCase {
]
],
false,
- ['users' => [], 'exact' => ['users' => [['uuid' => 'uid1', 'name' => 'User', 'label' => 'User (test@example.com)','value' => ['shareType' => Share::SHARE_TYPE_USER, 'shareWith' => 'test'],]]]],
+ ['users' => [], 'exact' => ['users' => [['uuid' => 'uid1', 'name' => 'User', 'label' => 'User (test@example.com)','value' => ['shareType' => IShare::TYPE_USER, 'shareWith' => 'test'],]]]],
true,
false,
],
@@ -438,8 +438,8 @@ class MailPluginTest extends TestCase {
],
true,
['users' => [
- ['uuid' => 'uid1', 'name' => 'User1', 'label' => 'User1 (test@example.com)', 'value' => ['shareType' => Share::SHARE_TYPE_USER, 'shareWith' => 'test1']],
- ['uuid' => 'uid2', 'name' => 'User2', 'label' => 'User2 (test@example.de)', 'value' => ['shareType' => Share::SHARE_TYPE_USER, 'shareWith' => 'test2']],
+ ['uuid' => 'uid1', 'name' => 'User1', 'label' => 'User1 (test@example.com)', 'value' => ['shareType' => IShare::TYPE_USER, 'shareWith' => 'test1']],
+ ['uuid' => 'uid2', 'name' => 'User2', 'label' => 'User2 (test@example.de)', 'value' => ['shareType' => IShare::TYPE_USER, 'shareWith' => 'test2']],
], 'emails' => [], 'exact' => ['users' => [], 'emails' => []]],
false,
true,
@@ -476,8 +476,8 @@ class MailPluginTest extends TestCase {
],
true,
['emails' => [
- ['uuid' => 'uid1', 'name' => 'User1', 'type' => '', 'label' => 'User1 (test@example.com)', 'value' => ['shareType' => Share::SHARE_TYPE_EMAIL, 'shareWith' => 'test@example.com']],
- ['uuid' => 'uid2', 'name' => 'User2', 'type' => '', 'label' => 'User2 (test@example.de)', 'value' => ['shareType' => Share::SHARE_TYPE_EMAIL, 'shareWith' => 'test@example.de']],
+ ['uuid' => 'uid1', 'name' => 'User1', 'type' => '', 'label' => 'User1 (test@example.com)', 'value' => ['shareType' => IShare::TYPE_EMAIL, 'shareWith' => 'test@example.com']],
+ ['uuid' => 'uid2', 'name' => 'User2', 'type' => '', 'label' => 'User2 (test@example.de)', 'value' => ['shareType' => IShare::TYPE_EMAIL, 'shareWith' => 'test@example.de']],
], 'exact' => ['emails' => []]],
false,
true,
@@ -509,8 +509,8 @@ class MailPluginTest extends TestCase {
false,
['emails' => [
], 'exact' => ['emails' => [
- ['name' => 'User Name', 'uuid' => 'uid1', 'type' => 'HOME', 'label' => 'User Name (username@localhost)', 'value' => ['shareType' => Share::SHARE_TYPE_EMAIL, 'shareWith' => 'username@localhost']],
- ['name' => 'User Name', 'uuid' => 'uid1', 'type' => 'WORK', 'label' => 'User Name (username@other)', 'value' => ['shareType' => Share::SHARE_TYPE_EMAIL, 'shareWith' => 'username@other']]
+ ['name' => 'User Name', 'uuid' => 'uid1', 'type' => 'HOME', 'label' => 'User Name (username@localhost)', 'value' => ['shareType' => IShare::TYPE_EMAIL, 'shareWith' => 'username@localhost']],
+ ['name' => 'User Name', 'uuid' => 'uid1', 'type' => 'WORK', 'label' => 'User Name (username@other)', 'value' => ['shareType' => IShare::TYPE_EMAIL, 'shareWith' => 'username@other']]
]]],
false,
false,
diff --git a/tests/lib/Collaboration/Collaborators/RemotePluginTest.php b/tests/lib/Collaboration/Collaborators/RemotePluginTest.php
index a651d4ec1d4..531a8447bd2 100644
--- a/tests/lib/Collaboration/Collaborators/RemotePluginTest.php
+++ b/tests/lib/Collaboration/Collaborators/RemotePluginTest.php
@@ -33,7 +33,7 @@ use OCP\IConfig;
use OCP\IUser;
use OCP\IUserManager;
use OCP\IUserSession;
-use OCP\Share;
+use OCP\Share\IShare;
use Test\TestCase;
class RemotePluginTest extends TestCase {
@@ -150,7 +150,7 @@ class RemotePluginTest extends TestCase {
'test@remote',
[],
true,
- ['remotes' => [], 'exact' => ['remotes' => [['label' => 'test (remote)', 'value' => ['shareType' => Share::SHARE_TYPE_REMOTE, 'shareWith' => 'test@remote', 'server' => 'remote'], 'uuid' => 'test', 'name' => 'test']]]],
+ ['remotes' => [], 'exact' => ['remotes' => [['label' => 'test (remote)', 'value' => ['shareType' => IShare::TYPE_REMOTE, 'shareWith' => 'test@remote', 'server' => 'remote'], 'uuid' => 'test', 'name' => 'test']]]],
false,
true,
],
@@ -158,7 +158,7 @@ class RemotePluginTest extends TestCase {
'test@remote',
[],
false,
- ['remotes' => [], 'exact' => ['remotes' => [['label' => 'test (remote)', 'value' => ['shareType' => Share::SHARE_TYPE_REMOTE, 'shareWith' => 'test@remote', 'server' => 'remote'], 'uuid' => 'test', 'name' => 'test']]]],
+ ['remotes' => [], 'exact' => ['remotes' => [['label' => 'test (remote)', 'value' => ['shareType' => IShare::TYPE_REMOTE, 'shareWith' => 'test@remote', 'server' => 'remote'], 'uuid' => 'test', 'name' => 'test']]]],
false,
true,
],
@@ -184,7 +184,7 @@ class RemotePluginTest extends TestCase {
],
],
true,
- ['remotes' => [['name' => 'User @ Localhost', 'label' => 'User @ Localhost (username@localhost)', 'uuid' => 'uid1', 'type' => '', 'value' => ['shareType' => Share::SHARE_TYPE_REMOTE, 'shareWith' => 'username@localhost', 'server' => 'localhost']]], 'exact' => ['remotes' => []]],
+ ['remotes' => [['name' => 'User @ Localhost', 'label' => 'User @ Localhost (username@localhost)', 'uuid' => 'uid1', 'type' => '', 'value' => ['shareType' => IShare::TYPE_REMOTE, 'shareWith' => 'username@localhost', 'server' => 'localhost']]], 'exact' => ['remotes' => []]],
false,
true,
],
@@ -236,7 +236,7 @@ class RemotePluginTest extends TestCase {
],
],
true,
- ['remotes' => [['name' => 'User @ Localhost', 'label' => 'User @ Localhost (username@localhost)', 'uuid' => 'uid', 'type' => '', 'value' => ['shareType' => Share::SHARE_TYPE_REMOTE, 'shareWith' => 'username@localhost', 'server' => 'localhost']]], 'exact' => ['remotes' => [['label' => 'test (remote)', 'value' => ['shareType' => Share::SHARE_TYPE_REMOTE, 'shareWith' => 'test@remote', 'server' => 'remote'], 'uuid' => 'test', 'name' => 'test']]]],
+ ['remotes' => [['name' => 'User @ Localhost', 'label' => 'User @ Localhost (username@localhost)', 'uuid' => 'uid', 'type' => '', 'value' => ['shareType' => IShare::TYPE_REMOTE, 'shareWith' => 'username@localhost', 'server' => 'localhost']]], 'exact' => ['remotes' => [['label' => 'test (remote)', 'value' => ['shareType' => IShare::TYPE_REMOTE, 'shareWith' => 'test@remote', 'server' => 'remote'], 'uuid' => 'test', 'name' => 'test']]]],
false,
true,
],
@@ -262,7 +262,7 @@ class RemotePluginTest extends TestCase {
],
],
false,
- ['remotes' => [], 'exact' => ['remotes' => [['label' => 'test (remote)', 'value' => ['shareType' => Share::SHARE_TYPE_REMOTE, 'shareWith' => 'test@remote', 'server' => 'remote'], 'uuid' => 'test', 'name' => 'test']]]],
+ ['remotes' => [], 'exact' => ['remotes' => [['label' => 'test (remote)', 'value' => ['shareType' => IShare::TYPE_REMOTE, 'shareWith' => 'test@remote', 'server' => 'remote'], 'uuid' => 'test', 'name' => 'test']]]],
false,
true,
],
@@ -288,7 +288,7 @@ class RemotePluginTest extends TestCase {
],
],
true,
- ['remotes' => [], 'exact' => ['remotes' => [['name' => 'User @ Localhost', 'label' => 'User @ Localhost (username@localhost)', 'uuid' => 'uid1', 'type' => '', 'value' => ['shareType' => Share::SHARE_TYPE_REMOTE, 'shareWith' => 'username@localhost', 'server' => 'localhost']]]]],
+ ['remotes' => [], 'exact' => ['remotes' => [['name' => 'User @ Localhost', 'label' => 'User @ Localhost (username@localhost)', 'uuid' => 'uid1', 'type' => '', 'value' => ['shareType' => IShare::TYPE_REMOTE, 'shareWith' => 'username@localhost', 'server' => 'localhost']]]]],
true,
true,
],
@@ -314,7 +314,7 @@ class RemotePluginTest extends TestCase {
],
],
false,
- ['remotes' => [], 'exact' => ['remotes' => [['name' => 'User @ Localhost', 'label' => 'User @ Localhost (username@localhost)', 'uuid' => 'uid1', 'type' => '', 'value' => ['shareType' => Share::SHARE_TYPE_REMOTE, 'shareWith' => 'username@localhost', 'server' => 'localhost']]]]],
+ ['remotes' => [], 'exact' => ['remotes' => [['name' => 'User @ Localhost', 'label' => 'User @ Localhost (username@localhost)', 'uuid' => 'uid1', 'type' => '', 'value' => ['shareType' => IShare::TYPE_REMOTE, 'shareWith' => 'username@localhost', 'server' => 'localhost']]]]],
true,
true,
],
@@ -341,7 +341,7 @@ class RemotePluginTest extends TestCase {
],
],
false,
- ['remotes' => [], 'exact' => ['remotes' => [['name' => 'User Name @ Localhost', 'label' => 'User Name @ Localhost (user name@localhost)', 'uuid' => 'uid3', 'type' => '', 'value' => ['shareType' => Share::SHARE_TYPE_REMOTE, 'shareWith' => 'user name@localhost', 'server' => 'localhost']]]]],
+ ['remotes' => [], 'exact' => ['remotes' => [['name' => 'User Name @ Localhost', 'label' => 'User Name @ Localhost (user name@localhost)', 'uuid' => 'uid3', 'type' => '', 'value' => ['shareType' => IShare::TYPE_REMOTE, 'shareWith' => 'user name@localhost', 'server' => 'localhost']]]]],
true,
true,
],
@@ -368,7 +368,7 @@ class RemotePluginTest extends TestCase {
],
],
false,
- ['remotes' => [], 'exact' => ['remotes' => [['label' => 'user space (remote)', 'value' => ['shareType' => Share::SHARE_TYPE_REMOTE, 'shareWith' => 'user space@remote', 'server' => 'remote'], 'uuid' => 'user space', 'name' => 'user space']]]],
+ ['remotes' => [], 'exact' => ['remotes' => [['label' => 'user space (remote)', 'value' => ['shareType' => IShare::TYPE_REMOTE, 'shareWith' => 'user space@remote', 'server' => 'remote'], 'uuid' => 'user space', 'name' => 'user space']]]],
false,
true,
],
diff --git a/tests/lib/Collaboration/Collaborators/SearchTest.php b/tests/lib/Collaboration/Collaborators/SearchTest.php
index 1b68e8eacc1..ab731c05c21 100644
--- a/tests/lib/Collaboration/Collaborators/SearchTest.php
+++ b/tests/lib/Collaboration/Collaborators/SearchTest.php
@@ -29,7 +29,7 @@ use OCP\Collaboration\Collaborators\ISearch;
use OCP\Collaboration\Collaborators\ISearchPlugin;
use OCP\Collaboration\Collaborators\SearchResultType;
use OCP\IContainer;
-use OCP\Share;
+use OCP\Share\IShare;
use Test\TestCase;
class SearchTest extends TestCase {
@@ -132,7 +132,7 @@ class SearchTest extends TestCase {
public function dataSearchSharees() {
return [
[
- 'test', [Share::SHARE_TYPE_USER, Share::SHARE_TYPE_GROUP, Share::SHARE_TYPE_REMOTE], 1, 2, [], [], ['results' => [], 'exact' => [], 'exactIdMatch' => false],
+ 'test', [IShare::TYPE_USER, IShare::TYPE_GROUP, IShare::TYPE_REMOTE], 1, 2, [], [], ['results' => [], 'exact' => [], 'exactIdMatch' => false],
[
'exact' => ['users' => [], 'groups' => [], 'remotes' => []],
'users' => [],
@@ -141,7 +141,7 @@ class SearchTest extends TestCase {
], false
],
[
- 'test', [Share::SHARE_TYPE_USER, Share::SHARE_TYPE_GROUP, Share::SHARE_TYPE_REMOTE], 1, 2, [], [], ['results' => [], 'exact' => [], 'exactIdMatch' => false],
+ 'test', [IShare::TYPE_USER, IShare::TYPE_GROUP, IShare::TYPE_REMOTE], 1, 2, [], [], ['results' => [], 'exact' => [], 'exactIdMatch' => false],
[
'exact' => ['users' => [], 'groups' => [], 'remotes' => []],
'users' => [],
@@ -150,66 +150,66 @@ class SearchTest extends TestCase {
], false
],
[
- 'test', [Share::SHARE_TYPE_USER, Share::SHARE_TYPE_GROUP, Share::SHARE_TYPE_REMOTE], 1, 2, [
- ['label' => 'test One', 'value' => ['shareType' => Share::SHARE_TYPE_USER, 'shareWith' => 'test1']],
+ 'test', [IShare::TYPE_USER, IShare::TYPE_GROUP, IShare::TYPE_REMOTE], 1, 2, [
+ ['label' => 'test One', 'value' => ['shareType' => IShare::TYPE_USER, 'shareWith' => 'test1']],
], [
- ['label' => 'testgroup1', 'value' => ['shareType' => Share::SHARE_TYPE_GROUP, 'shareWith' => 'testgroup1']],
+ ['label' => 'testgroup1', 'value' => ['shareType' => IShare::TYPE_GROUP, 'shareWith' => 'testgroup1']],
], [
- 'results' => [['label' => 'testz@remote', 'value' => ['shareType' => Share::SHARE_TYPE_REMOTE, 'shareWith' => 'testz@remote']]], 'exact' => [], 'exactIdMatch' => false,
+ 'results' => [['label' => 'testz@remote', 'value' => ['shareType' => IShare::TYPE_REMOTE, 'shareWith' => 'testz@remote']]], 'exact' => [], 'exactIdMatch' => false,
],
[
'exact' => ['users' => [], 'groups' => [], 'remotes' => []],
'users' => [
- ['label' => 'test One', 'value' => ['shareType' => Share::SHARE_TYPE_USER, 'shareWith' => 'test1']],
+ ['label' => 'test One', 'value' => ['shareType' => IShare::TYPE_USER, 'shareWith' => 'test1']],
],
'groups' => [
- ['label' => 'testgroup1', 'value' => ['shareType' => Share::SHARE_TYPE_GROUP, 'shareWith' => 'testgroup1']],
+ ['label' => 'testgroup1', 'value' => ['shareType' => IShare::TYPE_GROUP, 'shareWith' => 'testgroup1']],
],
'remotes' => [
- ['label' => 'testz@remote', 'value' => ['shareType' => Share::SHARE_TYPE_REMOTE, 'shareWith' => 'testz@remote']],
+ ['label' => 'testz@remote', 'value' => ['shareType' => IShare::TYPE_REMOTE, 'shareWith' => 'testz@remote']],
],
], true,
],
// No groups requested
[
- 'test', [Share::SHARE_TYPE_USER, Share::SHARE_TYPE_REMOTE], 1, 2, [
- ['label' => 'test One', 'value' => ['shareType' => Share::SHARE_TYPE_USER, 'shareWith' => 'test1']],
+ 'test', [IShare::TYPE_USER, IShare::TYPE_REMOTE], 1, 2, [
+ ['label' => 'test One', 'value' => ['shareType' => IShare::TYPE_USER, 'shareWith' => 'test1']],
], [], [
- 'results' => [['label' => 'testz@remote', 'value' => ['shareType' => Share::SHARE_TYPE_REMOTE, 'shareWith' => 'testz@remote']]], 'exact' => [], 'exactIdMatch' => false
+ 'results' => [['label' => 'testz@remote', 'value' => ['shareType' => IShare::TYPE_REMOTE, 'shareWith' => 'testz@remote']]], 'exact' => [], 'exactIdMatch' => false
],
[
'exact' => ['users' => [], 'remotes' => []],
'users' => [
- ['label' => 'test One', 'value' => ['shareType' => Share::SHARE_TYPE_USER, 'shareWith' => 'test1']],
+ ['label' => 'test One', 'value' => ['shareType' => IShare::TYPE_USER, 'shareWith' => 'test1']],
],
'remotes' => [
- ['label' => 'testz@remote', 'value' => ['shareType' => Share::SHARE_TYPE_REMOTE, 'shareWith' => 'testz@remote']],
+ ['label' => 'testz@remote', 'value' => ['shareType' => IShare::TYPE_REMOTE, 'shareWith' => 'testz@remote']],
],
], false,
],
// Share type restricted to user - Only one user
[
- 'test', [Share::SHARE_TYPE_USER], 1, 2, [
- ['label' => 'test One', 'value' => ['shareType' => Share::SHARE_TYPE_USER, 'shareWith' => 'test1']],
+ 'test', [IShare::TYPE_USER], 1, 2, [
+ ['label' => 'test One', 'value' => ['shareType' => IShare::TYPE_USER, 'shareWith' => 'test1']],
], [], [],
[
'exact' => ['users' => []],
'users' => [
- ['label' => 'test One', 'value' => ['shareType' => Share::SHARE_TYPE_USER, 'shareWith' => 'test1']],
+ ['label' => 'test One', 'value' => ['shareType' => IShare::TYPE_USER, 'shareWith' => 'test1']],
],
], false,
],
// Share type restricted to user - Multipage result
[
- 'test', [Share::SHARE_TYPE_USER], 1, 2, [
- ['label' => 'test 1', 'value' => ['shareType' => Share::SHARE_TYPE_USER, 'shareWith' => 'test1']],
- ['label' => 'test 2', 'value' => ['shareType' => Share::SHARE_TYPE_USER, 'shareWith' => 'test2']],
+ 'test', [IShare::TYPE_USER], 1, 2, [
+ ['label' => 'test 1', 'value' => ['shareType' => IShare::TYPE_USER, 'shareWith' => 'test1']],
+ ['label' => 'test 2', 'value' => ['shareType' => IShare::TYPE_USER, 'shareWith' => 'test2']],
], [], [],
[
'exact' => ['users' => []],
'users' => [
- ['label' => 'test 1', 'value' => ['shareType' => Share::SHARE_TYPE_USER, 'shareWith' => 'test1']],
- ['label' => 'test 2', 'value' => ['shareType' => Share::SHARE_TYPE_USER, 'shareWith' => 'test2']],
+ ['label' => 'test 1', 'value' => ['shareType' => IShare::TYPE_USER, 'shareWith' => 'test1']],
+ ['label' => 'test 2', 'value' => ['shareType' => IShare::TYPE_USER, 'shareWith' => 'test2']],
],
], true,
],
diff --git a/tests/lib/Collaboration/Collaborators/UserPluginTest.php b/tests/lib/Collaboration/Collaborators/UserPluginTest.php
index 40813c82850..8ca612f6069 100644
--- a/tests/lib/Collaboration/Collaborators/UserPluginTest.php
+++ b/tests/lib/Collaboration/Collaborators/UserPluginTest.php
@@ -32,7 +32,7 @@ use OCP\IGroupManager;
use OCP\IUser;
use OCP\IUserManager;
use OCP\IUserSession;
-use OCP\Share;
+use OCP\Share\IShare;
use Test\TestCase;
class UserPluginTest extends TestCase {
@@ -144,13 +144,13 @@ class UserPluginTest extends TestCase {
[
'test', false, true, [], [],
[
- ['label' => 'Test', 'value' => ['shareType' => Share::SHARE_TYPE_USER, 'shareWith' => 'test']],
+ ['label' => 'Test', 'value' => ['shareType' => IShare::TYPE_USER, 'shareWith' => 'test']],
], [], true, $this->getUserMock('test', 'Test'),
],
[
'test', false, false, [], [],
[
- ['label' => 'Test', 'value' => ['shareType' => Share::SHARE_TYPE_USER, 'shareWith' => 'test']],
+ ['label' => 'Test', 'value' => ['shareType' => IShare::TYPE_USER, 'shareWith' => 'test']],
], [], true, $this->getUserMock('test', 'Test'),
],
[
@@ -164,13 +164,13 @@ class UserPluginTest extends TestCase {
[
'test', true, true, ['test-group'], [['test-group', 'test', 2, 0, []]],
[
- ['label' => 'Test', 'value' => ['shareType' => Share::SHARE_TYPE_USER, 'shareWith' => 'test']],
+ ['label' => 'Test', 'value' => ['shareType' => IShare::TYPE_USER, 'shareWith' => 'test']],
], [], true, $this->getUserMock('test', 'Test'),
],
[
'test', true, false, ['test-group'], [['test-group', 'test', 2, 0, []]],
[
- ['label' => 'Test', 'value' => ['shareType' => Share::SHARE_TYPE_USER, 'shareWith' => 'test']],
+ ['label' => 'Test', 'value' => ['shareType' => IShare::TYPE_USER, 'shareWith' => 'test']],
], [], true, $this->getUserMock('test', 'Test'),
],
[
@@ -183,7 +183,7 @@ class UserPluginTest extends TestCase {
],
[],
[
- ['label' => 'Test One', 'value' => ['shareType' => Share::SHARE_TYPE_USER, 'shareWith' => 'test1']],
+ ['label' => 'Test One', 'value' => ['shareType' => IShare::TYPE_USER, 'shareWith' => 'test1']],
],
true,
false,
@@ -212,8 +212,8 @@ class UserPluginTest extends TestCase {
],
[],
[
- ['label' => 'Test One', 'value' => ['shareType' => Share::SHARE_TYPE_USER, 'shareWith' => 'test1']],
- ['label' => 'Test Two', 'value' => ['shareType' => Share::SHARE_TYPE_USER, 'shareWith' => 'test2']],
+ ['label' => 'Test One', 'value' => ['shareType' => IShare::TYPE_USER, 'shareWith' => 'test1']],
+ ['label' => 'Test Two', 'value' => ['shareType' => IShare::TYPE_USER, 'shareWith' => 'test2']],
],
false,
false,
@@ -243,11 +243,11 @@ class UserPluginTest extends TestCase {
$this->getUserMock('test2', 'Test Two'),
],
[
- ['label' => 'Test', 'value' => ['shareType' => Share::SHARE_TYPE_USER, 'shareWith' => 'test0']],
+ ['label' => 'Test', 'value' => ['shareType' => IShare::TYPE_USER, 'shareWith' => 'test0']],
],
[
- ['label' => 'Test One', 'value' => ['shareType' => Share::SHARE_TYPE_USER, 'shareWith' => 'test1']],
- ['label' => 'Test Two', 'value' => ['shareType' => Share::SHARE_TYPE_USER, 'shareWith' => 'test2']],
+ ['label' => 'Test One', 'value' => ['shareType' => IShare::TYPE_USER, 'shareWith' => 'test1']],
+ ['label' => 'Test Two', 'value' => ['shareType' => IShare::TYPE_USER, 'shareWith' => 'test2']],
],
false,
false,
@@ -263,7 +263,7 @@ class UserPluginTest extends TestCase {
$this->getUserMock('test2', 'Test Two'),
],
[
- ['label' => 'Test', 'value' => ['shareType' => Share::SHARE_TYPE_USER, 'shareWith' => 'test0']],
+ ['label' => 'Test', 'value' => ['shareType' => IShare::TYPE_USER, 'shareWith' => 'test0']],
],
[],
true,
@@ -280,7 +280,7 @@ class UserPluginTest extends TestCase {
],
[],
[
- ['label' => 'Test One', 'value' => ['shareType' => Share::SHARE_TYPE_USER, 'shareWith' => 'test1']],
+ ['label' => 'Test One', 'value' => ['shareType' => IShare::TYPE_USER, 'shareWith' => 'test1']],
],
true,
false,
@@ -318,8 +318,8 @@ class UserPluginTest extends TestCase {
],
[],
[
- ['label' => 'Test One', 'value' => ['shareType' => Share::SHARE_TYPE_USER, 'shareWith' => 'test1']],
- ['label' => 'Test Two', 'value' => ['shareType' => Share::SHARE_TYPE_USER, 'shareWith' => 'test2']],
+ ['label' => 'Test One', 'value' => ['shareType' => IShare::TYPE_USER, 'shareWith' => 'test1']],
+ ['label' => 'Test Two', 'value' => ['shareType' => IShare::TYPE_USER, 'shareWith' => 'test2']],
],
false,
false,
@@ -366,10 +366,10 @@ class UserPluginTest extends TestCase {
]],
],
[
- ['label' => 'Test One', 'value' => ['shareType' => Share::SHARE_TYPE_USER, 'shareWith' => 'test']],
+ ['label' => 'Test One', 'value' => ['shareType' => IShare::TYPE_USER, 'shareWith' => 'test']],
],
[
- ['label' => 'Test Two', 'value' => ['shareType' => Share::SHARE_TYPE_USER, 'shareWith' => 'test2']],
+ ['label' => 'Test Two', 'value' => ['shareType' => IShare::TYPE_USER, 'shareWith' => 'test2']],
],
false,
false,
@@ -392,7 +392,7 @@ class UserPluginTest extends TestCase {
]],
],
[
- ['label' => 'Test One', 'value' => ['shareType' => Share::SHARE_TYPE_USER, 'shareWith' => 'test']],
+ ['label' => 'Test One', 'value' => ['shareType' => IShare::TYPE_USER, 'shareWith' => 'test']],
],
[],
true,
diff --git a/tests/lib/DB/schemDiffData/core.xml b/tests/lib/DB/schemDiffData/core.xml
index 3775eb6cb37..d7edc7dc73e 100644
--- a/tests/lib/DB/schemDiffData/core.xml
+++ b/tests/lib/DB/schemDiffData/core.xml
@@ -526,7 +526,7 @@
<length>4</length>
</field>
- <!-- Constant OCP\Share::SHARE_TYPE_* -->
+ <!-- Constant OCP\Share\IShare::TYPE_* -->
<field>
<name>share_type</name>
<type>integer</type>
diff --git a/tests/lib/Files/ViewTest.php b/tests/lib/Files/ViewTest.php
index 9dbe2a4e10e..036fc038a60 100644
--- a/tests/lib/Files/ViewTest.php
+++ b/tests/lib/Files/ViewTest.php
@@ -21,7 +21,7 @@ use OCP\Files\FileInfo;
use OCP\Files\Storage\IStorage;
use OCP\Lock\ILockingProvider;
use OCP\Lock\LockedException;
-use OCP\Share;
+use OCP\Share\IShare;
use OCP\Util;
use Test\HookHelper;
use Test\TestMoveableMountPoint;
@@ -243,7 +243,7 @@ class ViewTest extends \Test\TestCase {
$this->assertEquals('/foo.txt', $folderView->getPath($id2));
}
-
+
public function testGetPathNotExisting() {
$this->expectException(\OCP\Files\NotFoundException::class);
@@ -1290,7 +1290,7 @@ class ViewTest extends \Test\TestCase {
$this->assertNull($view->getRelativePath(null));
}
-
+
public function testNullAsRoot() {
$this->expectException(\InvalidArgumentException::class);
@@ -1678,7 +1678,7 @@ class ViewTest extends \Test\TestCase {
$share = $shareManager->newShare();
$share->setSharedWith('test2')
->setSharedBy($this->user)
- ->setShareType(\OCP\Share::SHARE_TYPE_USER)
+ ->setShareType(IShare::TYPE_USER)
->setPermissions(\OCP\Constants::PERMISSION_READ)
->setNode($shareDir);
$shareManager->createShare($share);
@@ -1687,7 +1687,7 @@ class ViewTest extends \Test\TestCase {
$this->assertFalse($view->rename('mount1', 'shareddir/sub'), 'Cannot move mount point into shared folder');
$this->assertFalse($view->rename('mount1', 'shareddir/sub/sub2'), 'Cannot move mount point into shared subfolder');
- $this->assertTrue(\OC\Share\Share::unshare('folder', $fileId, Share::SHARE_TYPE_USER, 'test2'));
+ $this->assertTrue(\OC\Share\Share::unshare('folder', $fileId, IShare::TYPE_USER, 'test2'));
$userObject->delete();
}
diff --git a/tests/lib/Repair/OldGroupMembershipSharesTest.php b/tests/lib/Repair/OldGroupMembershipSharesTest.php
index 331a86d01d0..dda23e8d3ab 100644
--- a/tests/lib/Repair/OldGroupMembershipSharesTest.php
+++ b/tests/lib/Repair/OldGroupMembershipSharesTest.php
@@ -9,8 +9,8 @@
namespace Test\Repair;
use OC\Repair\OldGroupMembershipShares;
-use OC\Share\Constants;
use OCP\Migration\IOutput;
+use OCP\Share\IShare;
/**
* Class OldGroupMembershipSharesTest
@@ -66,9 +66,9 @@ class OldGroupMembershipSharesTest extends \Test\TestCase {
['not-a-member', 'group', false],
]);
- $parent = $this->createShare(Constants::SHARE_TYPE_GROUP, 'group', null);
- $group2 = $this->createShare(Constants::SHARE_TYPE_GROUP, 'group2', $parent);
- $user1 = $this->createShare(Constants::SHARE_TYPE_USER, 'user1', $parent);
+ $parent = $this->createShare(IShare::TYPE_GROUP, 'group', null);
+ $group2 = $this->createShare(IShare::TYPE_GROUP, 'group2', $parent);
+ $user1 = $this->createShare(IShare::TYPE_USER, 'user1', $parent);
// \OC\Share\Constant::$shareTypeGroupUserUnique === 2
$member = $this->createShare(2, 'member', $parent);
diff --git a/tests/lib/Repair/RepairInvalidSharesTest.php b/tests/lib/Repair/RepairInvalidSharesTest.php
index 23e6b2dad5f..748ca7a6048 100644
--- a/tests/lib/Repair/RepairInvalidSharesTest.php
+++ b/tests/lib/Repair/RepairInvalidSharesTest.php
@@ -9,10 +9,10 @@
namespace Test\Repair;
use OC\Repair\RepairInvalidShares;
-use OC\Share\Constants;
use OCP\IConfig;
use OCP\Migration\IOutput;
use OCP\Migration\IRepairStep;
+use OCP\Share\IShare;
use Test\TestCase;
/**
@@ -65,7 +65,7 @@ class RepairInvalidSharesTest extends TestCase {
public function testSharesNonExistingParent() {
$qb = $this->connection->getQueryBuilder();
$shareValues = [
- 'share_type' => $qb->expr()->literal(Constants::SHARE_TYPE_USER),
+ 'share_type' => $qb->expr()->literal(IShare::TYPE_USER),
'share_with' => $qb->expr()->literal('recipientuser1'),
'uid_owner' => $qb->expr()->literal('user1'),
'item_type' => $qb->expr()->literal('folder'),
@@ -159,7 +159,7 @@ class RepairInvalidSharesTest extends TestCase {
$qb = $this->connection->getQueryBuilder();
$qb->insert('share')
->values([
- 'share_type' => $qb->expr()->literal(Constants::SHARE_TYPE_LINK),
+ 'share_type' => $qb->expr()->literal(IShare::TYPE_LINK),
'uid_owner' => $qb->expr()->literal('user1'),
'item_type' => $qb->expr()->literal($itemType),
'item_source' => $qb->expr()->literal(123),
diff --git a/tests/lib/Share/ShareTest.php b/tests/lib/Share/ShareTest.php
index fce963ec43a..85cb188cbb3 100644
--- a/tests/lib/Share/ShareTest.php
+++ b/tests/lib/Share/ShareTest.php
@@ -21,11 +21,11 @@
namespace Test\Share;
-use OC\Share\Share;
use OCP\IGroup;
use OCP\IGroupManager;
use OCP\IUser;
use OCP\IUserManager;
+use OCP\Share\IShare;
/**
* Class Test_Share
@@ -140,15 +140,15 @@ class ShareTest extends \Test\TestCase {
$query = \OC_DB::prepare('INSERT INTO `*PREFIX*share` ('
.' `item_type`, `item_source`, `item_target`, `share_type`,'
.' `share_with`, `uid_owner`) VALUES (?,?,?,?,?,?)');
- $args = ['test', 99, 'target1', \OCP\Share::SHARE_TYPE_USER, $this->user2->getUID(), $this->user1->getUID()];
+ $args = ['test', 99, 'target1', IShare::TYPE_USER, $this->user2->getUID(), $this->user1->getUID()];
$query->execute($args);
- $args = ['test', 99, 'target2', \OCP\Share::SHARE_TYPE_USER, $this->user4->getUID(), $this->user1->getUID()];
+ $args = ['test', 99, 'target2', IShare::TYPE_USER, $this->user4->getUID(), $this->user1->getUID()];
$query->execute($args);
- $args = ['test', 99, 'target3', \OCP\Share::SHARE_TYPE_USER, $this->user3->getUID(), $this->user2->getUID()];
+ $args = ['test', 99, 'target3', IShare::TYPE_USER, $this->user3->getUID(), $this->user2->getUID()];
$query->execute($args);
- $args = ['test', 99, 'target4', \OCP\Share::SHARE_TYPE_USER, $this->user3->getUID(), $this->user4->getUID()];
+ $args = ['test', 99, 'target4', IShare::TYPE_USER, $this->user3->getUID(), $this->user4->getUID()];
$query->execute($args);
- $args = ['test', 99, 'target4', \OCP\Share::SHARE_TYPE_USER, $this->user6->getUID(), $this->user4->getUID()];
+ $args = ['test', 99, 'target4', IShare::TYPE_USER, $this->user6->getUID(), $this->user4->getUID()];
$query->execute($args);
@@ -180,13 +180,13 @@ class ShareTest extends \Test\TestCase {
$query = \OC_DB::prepare('INSERT INTO `*PREFIX*share` ('
.' `item_type`, `item_source`, `item_target`, `share_type`,'
.' `share_with`, `uid_owner`) VALUES (?,?,?,?,?,?)');
- $args = ['test', 99, 'target1', \OCP\Share::SHARE_TYPE_GROUP, $this->group1->getGID(), $this->user1->getUID()];
+ $args = ['test', 99, 'target1', IShare::TYPE_GROUP, $this->group1->getGID(), $this->user1->getUID()];
$query->execute($args);
- $args = ['test', 99, 'target2', \OCP\Share::SHARE_TYPE_GROUP, $this->group2->getGID(), $this->user1->getUID()];
+ $args = ['test', 99, 'target2', IShare::TYPE_GROUP, $this->group2->getGID(), $this->user1->getUID()];
$query->execute($args);
- $args = ['test', 99, 'target3', \OCP\Share::SHARE_TYPE_GROUP, $this->group1->getGID(), $this->user2->getUID()];
+ $args = ['test', 99, 'target3', IShare::TYPE_GROUP, $this->group1->getGID(), $this->user2->getUID()];
$query->execute($args);
- $args = ['test', 99, 'target4', \OCP\Share::SHARE_TYPE_GROUP, $this->group1->getGID(), $this->user4->getUID()];
+ $args = ['test', 99, 'target4', IShare::TYPE_GROUP, $this->group1->getGID(), $this->user4->getUID()];
$query->execute($args);
// user2 is in group1 and group2
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],
];
}
diff --git a/tests/lib/TagsTest.php b/tests/lib/TagsTest.php
index fd6283d2f27..38d3d611bb8 100644
--- a/tests/lib/TagsTest.php
+++ b/tests/lib/TagsTest.php
@@ -24,6 +24,7 @@ namespace Test;
use OCP\IUser;
use OCP\IUserSession;
+use OCP\Share\IShare;
/**
* Class TagsTest
@@ -314,7 +315,7 @@ class TagsTest extends \Test\TestCase {
\OC_User::setUserId($this->user->getUID());
// TODO new sharing
- \OC\Share\Share::shareItem('test', 1, \OCP\Share::SHARE_TYPE_USER, $otherUserId, \OCP\Constants::PERMISSION_READ);
+ \OC\Share\Share::shareItem('test', 1, IShare::TYPE_USER, $otherUserId, \OCP\Constants::PERMISSION_READ);
\OC_User::setUserId($otherUserId);
$otherTagger = $otherTagMgr->load('test', [], true); // Update tags, load shared ones.