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
diff options
context:
space:
mode:
authorJulius Härtl <jus@bitgrid.net>2020-06-15 10:29:30 +0300
committerJulius Härtl <jus@bitgrid.net>2020-06-15 10:34:57 +0300
commit294e40db5f01133d0b4227f3db85335924fe128f (patch)
tree0c6f28f18784d834bcc0471da30163218c91225b /tests/lib/Collaboration
parent5339d6df0218b430c40eed2fb794895adb1ebf83 (diff)
Avoid duplicate matches in wide and exact results
Signed-off-by: Julius Härtl <jus@bitgrid.net>
Diffstat (limited to 'tests/lib/Collaboration')
-rw-r--r--tests/lib/Collaboration/Collaborators/UserPluginTest.php41
1 files changed, 31 insertions, 10 deletions
diff --git a/tests/lib/Collaboration/Collaborators/UserPluginTest.php b/tests/lib/Collaboration/Collaborators/UserPluginTest.php
index 07bcce93529..0256c1eb157 100644
--- a/tests/lib/Collaboration/Collaborators/UserPluginTest.php
+++ b/tests/lib/Collaboration/Collaborators/UserPluginTest.php
@@ -522,7 +522,16 @@ class UserPluginTest extends TestCase {
['uid' => 'test1', 'groups' => ['groupA']],
['uid' => 'test2', 'groups' => ['groupB']],
],
- ['test1'],
+ ['exact' => [], 'wide' => ['test1']],
+ ],
+ [
+ 'test1',
+ ['groupA'],
+ [
+ ['uid' => 'test1', 'groups' => ['groupA']],
+ ['uid' => 'test2', 'groups' => ['groupB']],
+ ],
+ ['exact' => ['test1'], 'wide' => []],
],
[
'test',
@@ -531,7 +540,7 @@ class UserPluginTest extends TestCase {
['uid' => 'test1', 'groups' => ['groupA']],
['uid' => 'test2', 'groups' => ['groupB', 'groupA']],
],
- ['test1', 'test2'],
+ ['exact' => [], 'wide' => ['test1', 'test2']],
],
[
'test',
@@ -540,7 +549,7 @@ class UserPluginTest extends TestCase {
['uid' => 'test1', 'groups' => ['groupA', 'groupC']],
['uid' => 'test2', 'groups' => ['groupB', 'groupA']],
],
- ['test1', 'test2'],
+ ['exact' => [], 'wide' => ['test1', 'test2']],
],
[
'test',
@@ -549,7 +558,7 @@ class UserPluginTest extends TestCase {
['uid' => 'test1', 'groups' => ['groupA', 'groupC']],
['uid' => 'test2', 'groups' => ['groupB', 'groupA']],
],
- ['test1', 'test2'],
+ ['exact' => [], 'wide' => ['test1', 'test2']],
],
[
'test',
@@ -558,7 +567,7 @@ class UserPluginTest extends TestCase {
['uid' => 'test1', 'groups' => ['groupA']],
['uid' => 'test2', 'groups' => ['groupB', 'groupA']],
],
- [],
+ ['exact' => [], 'wide' => []],
],
[
'test',
@@ -567,7 +576,16 @@ class UserPluginTest extends TestCase {
['uid' => 'test1', 'groups' => []],
['uid' => 'test2', 'groups' => []],
],
- [],
+ ['exact' => [], 'wide' => []],
+ ],
+ [
+ 'test',
+ ['groupC', 'groupB'],
+ [
+ ['uid' => 'test1', 'groups' => []],
+ ['uid' => 'test2', 'groups' => []],
+ ],
+ ['exact' => [], 'wide' => []],
],
];
}
@@ -582,9 +600,12 @@ class UserPluginTest extends TestCase {
return $this->getUserMock($user['uid'], $user['uid']);
}, $matchingUsers);
- $mappedResult = array_map(function ($user) {
+ $mappedResultExact = array_map(function ($user) {
+ return ['label' => $user, 'value' => ['shareType' => 0, 'shareWith' => $user]];
+ }, $result['exact']);
+ $mappedResultWide = array_map(function ($user) {
return ['label' => $user, 'value' => ['shareType' => 0, 'shareWith' => $user]];
- }, $result);
+ }, $result['wide']);
$this->userManager->expects($this->once())
->method('searchDisplayName')
@@ -615,7 +636,7 @@ class UserPluginTest extends TestCase {
$this->plugin->search($search, $this->limit, $this->offset, $this->searchResult);
$result = $this->searchResult->asArray();
- $this->assertEquals([], $result['exact']['users']);
- $this->assertEquals($mappedResult, $result['users']);
+ $this->assertEquals($mappedResultExact, $result['exact']['users']);
+ $this->assertEquals($mappedResultWide, $result['users']);
}
}