diff options
author | Arthur Schiwon <blizzz@arthur-schiwon.de> | 2020-11-16 17:56:44 +0100 |
---|---|---|
committer | Arthur Schiwon <blizzz@arthur-schiwon.de> | 2020-11-24 11:30:11 +0100 |
commit | 16a78f535a3b607864e0d151de13b0f161520f5c (patch) | |
tree | a9024ddbfa76b51e123177628e17ccb840821880 /tests/lib/Collaboration/Collaborators | |
parent | 6d3d6fb81a9b52700f77463fb3fa9084b03132f5 (diff) | |
download | nextcloud-server-16a78f535a3b607864e0d151de13b0f161520f5c.tar.gz nextcloud-server-16a78f535a3b607864e0d151de13b0f161520f5c.zip |
set the display name of federated sharees from addressbook
Signed-off-by: Arthur Schiwon <blizzz@arthur-schiwon.de>
Diffstat (limited to 'tests/lib/Collaboration/Collaborators')
-rw-r--r-- | tests/lib/Collaboration/Collaborators/MailPluginTest.php | 19 | ||||
-rw-r--r-- | tests/lib/Collaboration/Collaborators/RemotePluginTest.php | 14 |
2 files changed, 25 insertions, 8 deletions
diff --git a/tests/lib/Collaboration/Collaborators/MailPluginTest.php b/tests/lib/Collaboration/Collaborators/MailPluginTest.php index b3a1e2c2756..8feebfab1c5 100644 --- a/tests/lib/Collaboration/Collaborators/MailPluginTest.php +++ b/tests/lib/Collaboration/Collaborators/MailPluginTest.php @@ -65,7 +65,8 @@ class MailPluginTest extends TestCase { $this->contactsManager = $this->createMock(IManager::class); $this->groupManager = $this->createMock(IGroupManager::class); $this->userSession = $this->createMock(IUserSession::class); - $this->cloudIdManager = new CloudIdManager(); + $this->cloudIdManager = new CloudIdManager($this->contactsManager); + $this->searchResult = new SearchResult(); } @@ -104,8 +105,12 @@ class MailPluginTest extends TestCase { $this->contactsManager->expects($this->any()) ->method('search') - ->with($searchTerm, ['EMAIL', '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(); @@ -553,8 +558,12 @@ class MailPluginTest extends TestCase { $this->contactsManager->expects($this->any()) ->method('search') - ->with($searchTerm, ['EMAIL', 'FN']) - ->willReturn($contacts); + ->willReturnCallback(function ($search, $searchAttributes) use ($searchTerm, $contacts) { + if ($search === $searchTerm) { + return $contacts; + } + return []; + }); $this->userSession->expects($this->any()) ->method('getUser') diff --git a/tests/lib/Collaboration/Collaborators/RemotePluginTest.php b/tests/lib/Collaboration/Collaborators/RemotePluginTest.php index c03f993508b..1345df13379 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); |