aboutsummaryrefslogtreecommitdiffstats
path: root/tests/lib/Collaboration
diff options
context:
space:
mode:
authorJoas Schilling <coding@schilljs.com>2021-04-19 14:06:34 +0200
committerJoas Schilling <coding@schilljs.com>2021-04-27 14:34:32 +0200
commitdf47445c014b83d8400bada6dad53d26d24fd803 (patch)
treec1b46093f33a84209a7b037647888703b31b2e82 /tests/lib/Collaboration
parent56ae87c281d2f54b23f98acf0e138d8e72196a06 (diff)
downloadnextcloud-server-df47445c014b83d8400bada6dad53d26d24fd803.tar.gz
nextcloud-server-df47445c014b83d8400bada6dad53d26d24fd803.zip
Fix unit tests
Signed-off-by: Joas Schilling <coding@schilljs.com>
Diffstat (limited to 'tests/lib/Collaboration')
-rw-r--r--tests/lib/Collaboration/Collaborators/LookupPluginTest.php25
-rw-r--r--tests/lib/Collaboration/Resources/ManagerTest.php8
-rw-r--r--tests/lib/Collaboration/Resources/ProviderManagerTest.php6
3 files changed, 20 insertions, 19 deletions
diff --git a/tests/lib/Collaboration/Collaborators/LookupPluginTest.php b/tests/lib/Collaboration/Collaborators/LookupPluginTest.php
index 81279c4c569..3ec9e6f5efc 100644
--- a/tests/lib/Collaboration/Collaborators/LookupPluginTest.php
+++ b/tests/lib/Collaboration/Collaborators/LookupPluginTest.php
@@ -33,25 +33,26 @@ use OCP\Http\Client\IClient;
use OCP\Http\Client\IClientService;
use OCP\Http\Client\IResponse;
use OCP\IConfig;
-use OCP\ILogger;
use OCP\IUser;
use OCP\IUserSession;
use OCP\Share\IShare;
+use PHPUnit\Framework\MockObject\MockObject;
+use Psr\Log\LoggerInterface;
use Test\TestCase;
class LookupPluginTest extends TestCase {
- /** @var IConfig|\PHPUnit\Framework\MockObject\MockObject */
+ /** @var IConfig|MockObject */
protected $config;
- /** @var IClientService|\PHPUnit\Framework\MockObject\MockObject */
+ /** @var IClientService|MockObject */
protected $clientService;
- /** @var IUserSession|\PHPUnit\Framework\MockObject\MockObject */
+ /** @var IUserSession|MockObject */
protected $userSession;
- /** @var ICloudIdManager|\PHPUnit\Framework\MockObject\MockObject */
+ /** @var ICloudIdManager|MockObject */
protected $cloudIdManager;
/** @var LookupPlugin */
protected $plugin;
- /** @var ILogger|\PHPUnit\Framework\MockObject\MockObject */
+ /** @var LoggerInterface|MockObject */
protected $logger;
protected function setUp(): void {
@@ -60,7 +61,7 @@ class LookupPluginTest extends TestCase {
$this->userSession = $this->createMock(IUserSession::class);
$this->cloudIdManager = $this->createMock(ICloudIdManager::class);
$this->config = $this->createMock(IConfig::class);
- $this->logger = $this->createMock(ILogger::class);
+ $this->logger = $this->createMock(LoggerInterface::class);
$this->clientService = $this->createMock(IClientService::class);
$cloudId = $this->createMock(ICloudId::class);
$cloudId->expects($this->any())->method('getRemote')->willReturn('myNextcloud.net');
@@ -108,7 +109,7 @@ class LookupPluginTest extends TestCase {
$this->clientService->expects($this->never())
->method('newClient');
- /** @var ISearchResult|\PHPUnit\Framework\MockObject\MockObject $searchResult */
+ /** @var ISearchResult|MockObject $searchResult */
$searchResult = $this->createMock(ISearchResult::class);
$this->plugin->search('foobar', 10, 0, $searchResult);
@@ -132,7 +133,7 @@ class LookupPluginTest extends TestCase {
$this->clientService->expects($this->never())
->method('newClient');
- /** @var ISearchResult|\PHPUnit\Framework\MockObject\MockObject $searchResult */
+ /** @var ISearchResult|MockObject $searchResult */
$searchResult = $this->createMock(ISearchResult::class);
$this->plugin->search('foobar', 10, 0, $searchResult);
@@ -145,7 +146,7 @@ class LookupPluginTest extends TestCase {
public function testSearch(array $searchParams) {
$type = new SearchResultType('lookup');
- /** @var ISearchResult|\PHPUnit\Framework\MockObject\MockObject $searchResult */
+ /** @var ISearchResult|MockObject $searchResult */
$searchResult = $this->createMock(ISearchResult::class);
$searchResult->expects($this->once())
->method('addResultSet')
@@ -207,7 +208,7 @@ class LookupPluginTest extends TestCase {
public function testSearchEnableDisableLookupServer(array $searchParams, $GSEnabled, $LookupEnabled) {
$type = new SearchResultType('lookup');
- /** @var ISearchResult|\PHPUnit\Framework\MockObject\MockObject $searchResult */
+ /** @var ISearchResult|MockObject $searchResult */
$searchResult = $this->createMock(ISearchResult::class);
$this->config->expects($this->once())
@@ -269,7 +270,7 @@ class LookupPluginTest extends TestCase {
->with('files_sharing', 'lookupServerEnabled', 'yes')
->willReturn('no');
- /** @var ISearchResult|\PHPUnit\Framework\MockObject\MockObject $searchResult */
+ /** @var ISearchResult|MockObject $searchResult */
$searchResult = $this->createMock(ISearchResult::class);
$searchResult->expects($this->never())
->method('addResultSet');
diff --git a/tests/lib/Collaboration/Resources/ManagerTest.php b/tests/lib/Collaboration/Resources/ManagerTest.php
index 092d4ffd39c..01a39660a7c 100644
--- a/tests/lib/Collaboration/Resources/ManagerTest.php
+++ b/tests/lib/Collaboration/Resources/ManagerTest.php
@@ -27,12 +27,12 @@ use OC\Collaboration\Resources\Manager;
use OCP\Collaboration\Resources\IManager;
use OCP\Collaboration\Resources\IProviderManager;
use OCP\IDBConnection;
-use OCP\ILogger;
+use Psr\Log\LoggerInterface;
use Test\TestCase;
class ManagerTest extends TestCase {
- /** @var ILogger */
+ /** @var LoggerInterface */
protected $logger;
/** @var IProviderManager */
protected $providerManager;
@@ -42,14 +42,14 @@ class ManagerTest extends TestCase {
protected function setUp(): void {
parent::setUp();
- $this->logger = $this->createMock(ILogger::class);
+ $this->logger = $this->createMock(LoggerInterface::class);
$this->providerManager = $this->createMock(IProviderManager::class);
/** @var IDBConnection $connection */
$connection = $this->createMock(IDBConnection::class);
$this->manager = new Manager($connection, $this->providerManager, $this->logger);
}
-
+
public function testRegisterResourceProvider(): void {
$this->logger->expects($this->once())
->method('debug')
diff --git a/tests/lib/Collaboration/Resources/ProviderManagerTest.php b/tests/lib/Collaboration/Resources/ProviderManagerTest.php
index 751e2cc1f8d..19a34962a56 100644
--- a/tests/lib/Collaboration/Resources/ProviderManagerTest.php
+++ b/tests/lib/Collaboration/Resources/ProviderManagerTest.php
@@ -27,15 +27,15 @@ use OC\Collaboration\Resources\ProviderManager;
use OCA\Files\Collaboration\Resources\ResourceProvider;
use OCP\AppFramework\QueryException;
use OCP\Collaboration\Resources\IProviderManager;
-use OCP\ILogger;
use OCP\IServerContainer;
+use Psr\Log\LoggerInterface;
use Test\TestCase;
class ProviderManagerTest extends TestCase {
/** @var IServerContainer */
protected $serverContainer;
- /** @var ILogger */
+ /** @var LoggerInterface */
protected $logger;
/** @var IProviderManager */
protected $providerManager;
@@ -44,7 +44,7 @@ class ProviderManagerTest extends TestCase {
parent::setUp();
$this->serverContainer = $this->createMock(IServerContainer::class);
- $this->logger = $this->createMock(ILogger::class);
+ $this->logger = $this->createMock(LoggerInterface::class);
$this->providerManager = new class($this->serverContainer, $this->logger) extends ProviderManager {
public function countProviders(): int {