aboutsummaryrefslogtreecommitdiffstats
path: root/tests/Core/Controller
diff options
context:
space:
mode:
authorArthur Schiwon <blizzz@arthur-schiwon.de>2017-10-31 14:58:48 +0100
committerArthur Schiwon <blizzz@arthur-schiwon.de>2017-10-31 14:58:48 +0100
commit25aad121e621f0a6975cd6982c11578e372abec2 (patch)
tree0fdbaf1af7f1d83d25efe89cb291598573833304 /tests/Core/Controller
parent582d2d36ee9cdbde891000608ff5f68f1efcfda8 (diff)
downloadnextcloud-server-25aad121e621f0a6975cd6982c11578e372abec2.tar.gz
nextcloud-server-25aad121e621f0a6975cd6982c11578e372abec2.zip
meanwhile we can have exact matches. also show those.
Signed-off-by: Arthur Schiwon <blizzz@arthur-schiwon.de>
Diffstat (limited to 'tests/Core/Controller')
-rw-r--r--tests/Core/Controller/AutoCompleteControllerTest.php29
1 files changed, 29 insertions, 0 deletions
diff --git a/tests/Core/Controller/AutoCompleteControllerTest.php b/tests/Core/Controller/AutoCompleteControllerTest.php
index 06d0bf5241d..bcd0d6e1cd3 100644
--- a/tests/Core/Controller/AutoCompleteControllerTest.php
+++ b/tests/Core/Controller/AutoCompleteControllerTest.php
@@ -86,4 +86,33 @@ class AutoCompleteControllerTest extends TestCase {
$this->assertEquals($expected, $list); // has better error output…
$this->assertSame($expected, $list);
}
+
+ public function testGetWithExactMatch() {
+ $searchResults = [
+ 'exact' => [
+ 'users' => [
+ ['label' => 'Bob Y.', 'value' => ['shareWith' => 'bob']],
+ ],
+ 'robots' => [],
+ ],
+ 'users' => [
+ ['label' => 'Robert R.', 'value' => ['shareWith' => 'bobby']],
+ ],
+ ];
+
+ $expected = [
+ [ 'id' => 'bob', 'label' => 'Bob Y.', 'source' => 'users'],
+ [ 'id' => 'bobby', 'label' => 'Robert R.', 'source' => 'users'],
+ ];
+
+ $this->collaboratorSearch->expects($this->once())
+ ->method('search')
+ ->willReturn([$searchResults, false]);
+
+ $response = $this->controller->get('bob', 'files', '42', null);
+
+ $list = $response->getData();
+ $this->assertEquals($expected, $list); // has better error output…
+ $this->assertSame($expected, $list);
+ }
}