From 1626a56ddab715e3c6af8081a9d696c74147ff79 Mon Sep 17 00:00:00 2001 From: Robin Appelman Date: Tue, 30 Aug 2022 18:15:02 +0200 Subject: adjusts tests for CloudIdManager Signed-off-by: Robin Appelman --- tests/lib/Federation/CloudIdManagerTest.php | 17 ++++++++++++++++- 1 file changed, 16 insertions(+), 1 deletion(-) (limited to 'tests/lib/Federation/CloudIdManagerTest.php') diff --git a/tests/lib/Federation/CloudIdManagerTest.php b/tests/lib/Federation/CloudIdManagerTest.php index 92f8a5fa8dd..0db36b0524a 100644 --- a/tests/lib/Federation/CloudIdManagerTest.php +++ b/tests/lib/Federation/CloudIdManagerTest.php @@ -22,7 +22,10 @@ namespace Test\Federation; use OC\Federation\CloudIdManager; +use OC\Memcache\ArrayCache; use OCP\Contacts\IManager; +use OCP\EventDispatcher\IEventDispatcher; +use OCP\ICacheFactory; use OCP\IURLGenerator; use OCP\IUserManager; use Test\TestCase; @@ -36,6 +39,8 @@ class CloudIdManagerTest extends TestCase { private $userManager; /** @var CloudIdManager */ private $cloudIdManager; + /** @var ICacheFactory|\PHPUnit\Framework\MockObject\MockObject */ + private $cacheFactory; protected function setUp(): void { @@ -45,7 +50,17 @@ class CloudIdManagerTest extends TestCase { $this->urlGenerator = $this->createMock(IURLGenerator::class); $this->userManager = $this->createMock(IUserManager::class); - $this->cloudIdManager = new CloudIdManager($this->contactsManager, $this->urlGenerator, $this->userManager); + $this->cacheFactory = $this->createMock(ICacheFactory::class); + $this->cacheFactory->method('createLocal') + ->willReturn(new ArrayCache('')); + + $this->cloudIdManager = new CloudIdManager( + $this->contactsManager, + $this->urlGenerator, + $this->userManager, + $this->cacheFactory, + $this->createMock(IEventDispatcher::class) + ); } public function cloudIdProvider() { -- cgit v1.2.3