diff options
Diffstat (limited to 'apps/federatedfilesharing/tests/AddressHandlerTest.php')
-rw-r--r-- | apps/federatedfilesharing/tests/AddressHandlerTest.php | 11 |
1 files changed, 10 insertions, 1 deletions
diff --git a/apps/federatedfilesharing/tests/AddressHandlerTest.php b/apps/federatedfilesharing/tests/AddressHandlerTest.php index 300622f1c00..4fc8805743b 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); |