aboutsummaryrefslogtreecommitdiffstats
path: root/tests/lib/Collaboration/Collaborators/RemotePluginTest.php
diff options
context:
space:
mode:
Diffstat (limited to 'tests/lib/Collaboration/Collaborators/RemotePluginTest.php')
-rw-r--r--tests/lib/Collaboration/Collaborators/RemotePluginTest.php14
1 files changed, 11 insertions, 3 deletions
diff --git a/tests/lib/Collaboration/Collaborators/RemotePluginTest.php b/tests/lib/Collaboration/Collaborators/RemotePluginTest.php
index a651d4ec1d4..94a1805492d 100644
--- a/tests/lib/Collaboration/Collaborators/RemotePluginTest.php
+++ b/tests/lib/Collaboration/Collaborators/RemotePluginTest.php
@@ -62,7 +62,7 @@ class RemotePluginTest extends TestCase {
$this->userManager = $this->createMock(IUserManager::class);
$this->config = $this->createMock(IConfig::class);
$this->contactsManager = $this->createMock(IManager::class);
- $this->cloudIdManager = new CloudIdManager();
+ $this->cloudIdManager = new CloudIdManager($this->contactsManager);
$this->searchResult = new SearchResult();
}
@@ -104,8 +104,12 @@ class RemotePluginTest extends TestCase {
$this->contactsManager->expects($this->any())
->method('search')
- ->with($searchTerm, ['CLOUD', 'FN'])
- ->willReturn($contacts);
+ ->willReturnCallback(function ($search, $searchAttributes) use ($searchTerm, $contacts) {
+ if ($search === $searchTerm) {
+ return $contacts;
+ }
+ return [];
+ });
$moreResults = $this->plugin->search($searchTerm, 2, 0, $this->searchResult);
$result = $this->searchResult->asArray();
@@ -125,6 +129,10 @@ class RemotePluginTest extends TestCase {
public function testSplitUserRemote($remote, $expectedUser, $expectedUrl) {
$this->instantiatePlugin();
+ $this->contactsManager->expects($this->any())
+ ->method('search')
+ ->willReturn([]);
+
list($remoteUser, $remoteUrl) = $this->plugin->splitUserRemote($remote);
$this->assertSame($expectedUser, $remoteUser);
$this->assertSame($expectedUrl, $remoteUrl);