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 /apps/files_sharing/tests | |
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 'apps/files_sharing/tests')
-rw-r--r-- | apps/files_sharing/tests/External/CacheTest.php | 12 | ||||
-rw-r--r-- | apps/files_sharing/tests/External/ManagerTest.php | 12 |
2 files changed, 22 insertions, 2 deletions
diff --git a/apps/files_sharing/tests/External/CacheTest.php b/apps/files_sharing/tests/External/CacheTest.php index be8911961df..0a5ea4ca231 100644 --- a/apps/files_sharing/tests/External/CacheTest.php +++ b/apps/files_sharing/tests/External/CacheTest.php @@ -29,6 +29,7 @@ namespace OCA\Files_Sharing\Tests\External; use OC\Federation\CloudIdManager; use OCA\Files_Sharing\Tests\TestCase; +use OCP\Contacts\IManager; use OCP\Federation\ICloudIdManager; /** @@ -39,6 +40,8 @@ use OCP\Federation\ICloudIdManager; * @package OCA\Files_Sharing\Tests\External */ class CacheTest extends TestCase { + /** @var IManager|\PHPUnit\Framework\MockObject\MockObject */ + protected $contactsManager; /** * @var \OC\Files\Storage\Storage @@ -61,7 +64,9 @@ class CacheTest extends TestCase { protected function setUp(): void { parent::setUp(); - $this->cloudIdManager = new CloudIdManager(); + $this->contactsManager = $this->createMock(IManager::class); + + $this->cloudIdManager = new CloudIdManager($this->contactsManager); $this->remoteUser = $this->getUniqueID('remoteuser'); $this->storage = $this->getMockBuilder('\OCA\Files_Sharing\External\Storage') @@ -71,6 +76,11 @@ class CacheTest extends TestCase { ->expects($this->any()) ->method('getId') ->willReturn('dummystorage::'); + + $this->contactsManager->expects($this->any()) + ->method('search') + ->willReturn([]); + $this->cache = new \OCA\Files_Sharing\External\Cache( $this->storage, $this->cloudIdManager->getCloudId($this->remoteUser, 'http://example.com/owncloud') diff --git a/apps/files_sharing/tests/External/ManagerTest.php b/apps/files_sharing/tests/External/ManagerTest.php index c8ae7a64831..22005c8fc6b 100644 --- a/apps/files_sharing/tests/External/ManagerTest.php +++ b/apps/files_sharing/tests/External/ManagerTest.php @@ -33,6 +33,7 @@ use OC\Files\Storage\StorageFactory; use OCA\Files_Sharing\External\Manager; use OCA\Files_Sharing\External\MountProvider; use OCA\Files_Sharing\Tests\TestCase; +use OCP\Contacts\IManager; use OCP\EventDispatcher\IEventDispatcher; use OCP\Federation\ICloudFederationFactory; use OCP\Federation\ICloudFederationProviderManager; @@ -53,6 +54,9 @@ use Test\Traits\UserTrait; class ManagerTest extends TestCase { use UserTrait; + /** @var IManager|\PHPUnit\Framework\MockObject\MockObject */ + protected $contactsManager; + /** @var Manager|\PHPUnit\Framework\MockObject\MockObject **/ private $manager; @@ -99,6 +103,12 @@ class ManagerTest extends TestCase { $this->userManager = $this->createMock(IUserManager::class); $this->eventDispatcher = $this->createMock(IEventDispatcher::class); + $this->contactsManager = $this->createMock(IManager::class); + // needed for MountProvider() initialization + $this->contactsManager->expects($this->any()) + ->method('search') + ->willReturn([]); + $this->manager = $this->getMockBuilder(Manager::class) ->setConstructorArgs( [ @@ -119,7 +129,7 @@ class ManagerTest extends TestCase { $this->testMountProvider = new MountProvider(\OC::$server->getDatabaseConnection(), function () { return $this->manager; - }, new CloudIdManager()); + }, new CloudIdManager($this->contactsManager)); } private function setupMounts() { |