Welcome to mirror list, hosted at ThFree Co, Russian Federation.

github.com/nextcloud/server.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
path: root/tests
diff options
context:
space:
mode:
authorGeorg Ehrke <developer@georgehrke.com>2020-08-05 11:37:20 +0300
committerGeorg Ehrke <developer@georgehrke.com>2020-08-14 18:04:52 +0300
commit5b26487f142843ad99a663d1ce2223c46a9498b2 (patch)
treeee28708b23007815af072ea5420d3813e70be2e8 /tests
parentb13aa660c91873437afec36ef6466ef609b7959c (diff)
Expose status via Collaborators API
Signed-off-by: Georg Ehrke <developer@georgehrke.com>
Diffstat (limited to 'tests')
-rw-r--r--tests/lib/Collaboration/Collaborators/UserPluginTest.php47
1 files changed, 27 insertions, 20 deletions
diff --git a/tests/lib/Collaboration/Collaborators/UserPluginTest.php b/tests/lib/Collaboration/Collaborators/UserPluginTest.php
index 6c4ffcc52d8..0db370d68b1 100644
--- a/tests/lib/Collaboration/Collaborators/UserPluginTest.php
+++ b/tests/lib/Collaboration/Collaborators/UserPluginTest.php
@@ -33,6 +33,7 @@ use OCP\IUser;
use OCP\IUserManager;
use OCP\IUserSession;
use OCP\Share\IShare;
+use OCP\UserStatus\IManager as IUserStatusManager;
use Test\TestCase;
class UserPluginTest extends TestCase {
@@ -48,6 +49,9 @@ class UserPluginTest extends TestCase {
/** @var IUserSession|\PHPUnit\Framework\MockObject\MockObject */
protected $session;
+ /** @var IUserStatusManager|\PHPUnit\Framework\MockObject\MockObject */
+ protected $userStatusManager;
+
/** @var UserPlugin */
protected $plugin;
@@ -74,6 +78,8 @@ class UserPluginTest extends TestCase {
$this->session = $this->createMock(IUserSession::class);
+ $this->userStatusManager = $this->createMock(IUserStatusManager::class);
+
$this->searchResult = new SearchResult();
$this->user = $this->getUserMock('admin', 'Administrator');
@@ -86,7 +92,8 @@ class UserPluginTest extends TestCase {
$this->config,
$this->userManager,
$this->groupManager,
- $this->session
+ $this->session,
+ $this->userStatusManager
);
}
@@ -144,13 +151,13 @@ class UserPluginTest extends TestCase {
[
'test', false, true, [], [],
[
- ['label' => 'Test', 'value' => ['shareType' => IShare::TYPE_USER, 'shareWith' => 'test']],
+ ['label' => 'Test', 'value' => ['shareType' => IShare::TYPE_USER, 'shareWith' => 'test'], 'status' => []],
], [], true, $this->getUserMock('test', 'Test'),
],
[
'test', false, false, [], [],
[
- ['label' => 'Test', 'value' => ['shareType' => IShare::TYPE_USER, 'shareWith' => 'test']],
+ ['label' => 'Test', 'value' => ['shareType' => IShare::TYPE_USER, 'shareWith' => 'test'], 'status' => []],
], [], true, $this->getUserMock('test', 'Test'),
],
[
@@ -164,13 +171,13 @@ class UserPluginTest extends TestCase {
[
'test', true, true, ['test-group'], [['test-group', 'test', 2, 0, []]],
[
- ['label' => 'Test', 'value' => ['shareType' => IShare::TYPE_USER, 'shareWith' => 'test']],
+ ['label' => 'Test', 'value' => ['shareType' => IShare::TYPE_USER, 'shareWith' => 'test'], 'status' => []],
], [], true, $this->getUserMock('test', 'Test'),
],
[
'test', true, false, ['test-group'], [['test-group', 'test', 2, 0, []]],
[
- ['label' => 'Test', 'value' => ['shareType' => IShare::TYPE_USER, 'shareWith' => 'test']],
+ ['label' => 'Test', 'value' => ['shareType' => IShare::TYPE_USER, 'shareWith' => 'test'], 'status' => []],
], [], true, $this->getUserMock('test', 'Test'),
],
[
@@ -183,7 +190,7 @@ class UserPluginTest extends TestCase {
],
[],
[
- ['label' => 'Test One', 'value' => ['shareType' => IShare::TYPE_USER, 'shareWith' => 'test1']],
+ ['label' => 'Test One', 'value' => ['shareType' => IShare::TYPE_USER, 'shareWith' => 'test1'], 'status' => []],
],
true,
false,
@@ -212,8 +219,8 @@ class UserPluginTest extends TestCase {
],
[],
[
- ['label' => 'Test One', 'value' => ['shareType' => IShare::TYPE_USER, 'shareWith' => 'test1']],
- ['label' => 'Test Two', 'value' => ['shareType' => IShare::TYPE_USER, 'shareWith' => 'test2']],
+ ['label' => 'Test One', 'value' => ['shareType' => IShare::TYPE_USER, 'shareWith' => 'test1'], 'status' => []],
+ ['label' => 'Test Two', 'value' => ['shareType' => IShare::TYPE_USER, 'shareWith' => 'test2'], 'status' => []],
],
false,
false,
@@ -243,11 +250,11 @@ class UserPluginTest extends TestCase {
$this->getUserMock('test2', 'Test Two'),
],
[
- ['label' => 'Test', 'value' => ['shareType' => IShare::TYPE_USER, 'shareWith' => 'test0']],
+ ['label' => 'Test', 'value' => ['shareType' => IShare::TYPE_USER, 'shareWith' => 'test0'], 'status' => []],
],
[
- ['label' => 'Test One', 'value' => ['shareType' => IShare::TYPE_USER, 'shareWith' => 'test1']],
- ['label' => 'Test Two', 'value' => ['shareType' => IShare::TYPE_USER, 'shareWith' => 'test2']],
+ ['label' => 'Test One', 'value' => ['shareType' => IShare::TYPE_USER, 'shareWith' => 'test1'], 'status' => []],
+ ['label' => 'Test Two', 'value' => ['shareType' => IShare::TYPE_USER, 'shareWith' => 'test2'], 'status' => []],
],
false,
false,
@@ -263,7 +270,7 @@ class UserPluginTest extends TestCase {
$this->getUserMock('test2', 'Test Two'),
],
[
- ['label' => 'Test', 'value' => ['shareType' => IShare::TYPE_USER, 'shareWith' => 'test0']],
+ ['label' => 'Test', 'value' => ['shareType' => IShare::TYPE_USER, 'shareWith' => 'test0'], 'status' => []],
],
[],
true,
@@ -280,7 +287,7 @@ class UserPluginTest extends TestCase {
],
[],
[
- ['label' => 'Test One', 'value' => ['shareType' => IShare::TYPE_USER, 'shareWith' => 'test1']],
+ ['label' => 'Test One', 'value' => ['shareType' => IShare::TYPE_USER, 'shareWith' => 'test1'], 'status' => []],
],
true,
false,
@@ -318,8 +325,8 @@ class UserPluginTest extends TestCase {
],
[],
[
- ['label' => 'Test One', 'value' => ['shareType' => IShare::TYPE_USER, 'shareWith' => 'test1']],
- ['label' => 'Test Two', 'value' => ['shareType' => IShare::TYPE_USER, 'shareWith' => 'test2']],
+ ['label' => 'Test One', 'value' => ['shareType' => IShare::TYPE_USER, 'shareWith' => 'test1'], 'status' => []],
+ ['label' => 'Test Two', 'value' => ['shareType' => IShare::TYPE_USER, 'shareWith' => 'test2'], 'status' => []],
],
false,
false,
@@ -366,10 +373,10 @@ class UserPluginTest extends TestCase {
]],
],
[
- ['label' => 'Test One', 'value' => ['shareType' => IShare::TYPE_USER, 'shareWith' => 'test']],
+ ['label' => 'Test One', 'value' => ['shareType' => IShare::TYPE_USER, 'shareWith' => 'test'], 'status' => []],
],
[
- ['label' => 'Test Two', 'value' => ['shareType' => IShare::TYPE_USER, 'shareWith' => 'test2']],
+ ['label' => 'Test Two', 'value' => ['shareType' => IShare::TYPE_USER, 'shareWith' => 'test2'], 'status' => []],
],
false,
false,
@@ -392,7 +399,7 @@ class UserPluginTest extends TestCase {
]],
],
[
- ['label' => 'Test One', 'value' => ['shareType' => IShare::TYPE_USER, 'shareWith' => 'test']],
+ ['label' => 'Test One', 'value' => ['shareType' => IShare::TYPE_USER, 'shareWith' => 'test'], 'status' => []],
],
[],
true,
@@ -611,10 +618,10 @@ class UserPluginTest extends TestCase {
}, $matchingUsers);
$mappedResultExact = array_map(function ($user) {
- return ['label' => $user, 'value' => ['shareType' => 0, 'shareWith' => $user]];
+ return ['label' => $user, 'value' => ['shareType' => 0, 'shareWith' => $user], 'status' => []];
}, $result['exact']);
$mappedResultWide = array_map(function ($user) {
- return ['label' => $user, 'value' => ['shareType' => 0, 'shareWith' => $user]];
+ return ['label' => $user, 'value' => ['shareType' => 0, 'shareWith' => $user], 'status' => []];
}, $result['wide']);
$this->userManager->expects($this->once())