Welcome to mirror list, hosted at ThFree Co, Russian Federation.

github.com/nextcloud/server.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
path: root/tests
diff options
context:
space:
mode:
authorRobin Appelman <robin@icewind.nl>2022-08-30 19:15:02 +0300
committerRobin Appelman <robin@icewind.nl>2022-08-31 16:47:00 +0300
commit1626a56ddab715e3c6af8081a9d696c74147ff79 (patch)
tree57b69d6fad632096d9c06dd890bc48dce7e7150f /tests
parentd3743392e0087c267d20db14210acba17a3ec6d2 (diff)
adjusts tests for CloudIdManagercloudid-cache
Signed-off-by: Robin Appelman <robin@icewind.nl>
Diffstat (limited to 'tests')
-rw-r--r--tests/lib/Collaboration/Collaborators/MailPluginTest.php10
-rw-r--r--tests/lib/Collaboration/Collaborators/RemotePluginTest.php10
-rw-r--r--tests/lib/Federation/CloudIdManagerTest.php17
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() {