summaryrefslogtreecommitdiffstats
path: root/apps/federatedfilesharing/tests/AddressHandlerTest.php
diff options
context:
space:
mode:
authorArthur Schiwon <blizzz@arthur-schiwon.de>2020-11-16 17:56:44 +0100
committerArthur Schiwon <blizzz@arthur-schiwon.de>2020-11-24 11:30:11 +0100
commit16a78f535a3b607864e0d151de13b0f161520f5c (patch)
treea9024ddbfa76b51e123177628e17ccb840821880 /apps/federatedfilesharing/tests/AddressHandlerTest.php
parent6d3d6fb81a9b52700f77463fb3fa9084b03132f5 (diff)
downloadnextcloud-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 'apps/federatedfilesharing/tests/AddressHandlerTest.php')
-rw-r--r--apps/federatedfilesharing/tests/AddressHandlerTest.php11
1 files changed, 10 insertions, 1 deletions
diff --git a/apps/federatedfilesharing/tests/AddressHandlerTest.php b/apps/federatedfilesharing/tests/AddressHandlerTest.php
index 6cfe9d60e1d..fb78e83ea68 100644
--- a/apps/federatedfilesharing/tests/AddressHandlerTest.php
+++ b/apps/federatedfilesharing/tests/AddressHandlerTest.php
@@ -29,10 +29,13 @@ namespace OCA\FederatedFileSharing\Tests;
use OC\Federation\CloudIdManager;
use OCA\FederatedFileSharing\AddressHandler;
+use OCP\Contacts\IManager;
use OCP\IL10N;
use OCP\IURLGenerator;
class AddressHandlerTest extends \Test\TestCase {
+ /** @var IManager|\PHPUnit\Framework\MockObject\MockObject */
+ protected $contactsManager;
/** @var AddressHandler */
private $addressHandler;
@@ -54,7 +57,9 @@ class AddressHandlerTest extends \Test\TestCase {
$this->il10n = $this->getMockBuilder(IL10N::class)
->getMock();
- $this->cloudIdManager = new CloudIdManager();
+ $this->contactsManager = $this->createMock(IManager::class);
+
+ $this->cloudIdManager = new CloudIdManager($this->contactsManager);
$this->addressHandler = new AddressHandler($this->urlGenerator, $this->il10n, $this->cloudIdManager);
}
@@ -98,6 +103,10 @@ class AddressHandlerTest extends \Test\TestCase {
* @param string $expectedUrl
*/
public function testSplitUserRemote($remote, $expectedUser, $expectedUrl) {
+ $this->contactsManager->expects($this->any())
+ ->method('search')
+ ->willReturn([]);
+
list($remoteUser, $remoteUrl) = $this->addressHandler->splitUserRemote($remote);
$this->assertSame($expectedUser, $remoteUser);
$this->assertSame($expectedUrl, $remoteUrl);