diff options
author | Vincent Petry <vincent@nextcloud.com> | 2022-09-01 13:27:12 +0200 |
---|---|---|
committer | GitHub <noreply@github.com> | 2022-09-01 13:27:12 +0200 |
commit | 3ae439710e76de6916584ada18a5baea9838e300 (patch) | |
tree | 0efcbda5828d545023189b0bf27bc7441e9754bc /tests | |
parent | 7ea84277f886a1f59a80011ccdb80c71a2105c18 (diff) | |
parent | 1626a56ddab715e3c6af8081a9d696c74147ff79 (diff) | |
download | nextcloud-server-3ae439710e76de6916584ada18a5baea9838e300.tar.gz nextcloud-server-3ae439710e76de6916584ada18a5baea9838e300.zip |
Merge pull request #33764 from nextcloud/cloudid-cache
cache cloud id data in CloudIdManager
Diffstat (limited to 'tests')
-rw-r--r-- | tests/lib/Collaboration/Collaborators/MailPluginTest.php | 10 | ||||
-rw-r--r-- | tests/lib/Collaboration/Collaborators/RemotePluginTest.php | 10 | ||||
-rw-r--r-- | tests/lib/Federation/CloudIdManagerTest.php | 17 |
3 files changed, 34 insertions, 3 deletions
diff --git a/tests/lib/Collaboration/Collaborators/MailPluginTest.php b/tests/lib/Collaboration/Collaborators/MailPluginTest.php index 702c1d6be6e..3cf76c562a1 100644 --- a/tests/lib/Collaboration/Collaborators/MailPluginTest.php +++ b/tests/lib/Collaboration/Collaborators/MailPluginTest.php @@ -29,7 +29,9 @@ use OC\Federation\CloudIdManager; use OC\KnownUser\KnownUserService; use OCP\Collaboration\Collaborators\SearchResultType; use OCP\Contacts\IManager; +use OCP\EventDispatcher\IEventDispatcher; use OCP\Federation\ICloudIdManager; +use OCP\ICacheFactory; use OCP\IConfig; use OCP\IGroupManager; use OCP\IURLGenerator; @@ -77,7 +79,13 @@ class MailPluginTest extends TestCase { $this->knownUserService = $this->createMock(KnownUserService::class); $this->userSession = $this->createMock(IUserSession::class); $this->mailer = $this->createMock(IMailer::class); - $this->cloudIdManager = new CloudIdManager($this->contactsManager, $this->createMock(IURLGenerator::class), $this->createMock(IUserManager::class)); + $this->cloudIdManager = new CloudIdManager( + $this->contactsManager, + $this->createMock(IURLGenerator::class), + $this->createMock(IUserManager::class), + $this->createMock(ICacheFactory::class), + $this->createMock(IEventDispatcher::class) + ); $this->searchResult = new SearchResult(); } diff --git a/tests/lib/Collaboration/Collaborators/RemotePluginTest.php b/tests/lib/Collaboration/Collaborators/RemotePluginTest.php index 4072f3ecde1..22bd6f84be9 100644 --- a/tests/lib/Collaboration/Collaborators/RemotePluginTest.php +++ b/tests/lib/Collaboration/Collaborators/RemotePluginTest.php @@ -28,7 +28,9 @@ use OC\Collaboration\Collaborators\SearchResult; use OC\Federation\CloudIdManager; use OCP\Collaboration\Collaborators\SearchResultType; use OCP\Contacts\IManager; +use OCP\EventDispatcher\IEventDispatcher; use OCP\Federation\ICloudIdManager; +use OCP\ICacheFactory; use OCP\IConfig; use OCP\IURLGenerator; use OCP\IUser; @@ -63,7 +65,13 @@ 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->contactsManager, $this->createMock(IURLGenerator::class), $this->createMock(IUserManager::class)); + $this->cloudIdManager = new CloudIdManager( + $this->contactsManager, + $this->createMock(IURLGenerator::class), + $this->createMock(IUserManager::class), + $this->createMock(ICacheFactory::class), + $this->createMock(IEventDispatcher::class) + ); $this->searchResult = new SearchResult(); } 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() { |