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:
authorVincent Petry <vincent@nextcloud.com>2021-03-24 10:48:28 +0300
committerVincent Petry <vincent@nextcloud.com>2021-03-24 10:48:28 +0300
commit9b8ca1697af3003d58febd043ad183fe3876e62e (patch)
treedaaa4dd68ec570e5ac30def2c7128013933a2fb0 /tests
parentc467f648482dbcaa5466d0ce6c589c5b9d1ef9db (diff)
Fix more tests in the Core subdir
Signed-off-by: Vincent Petry <vincent@nextcloud.com>
Diffstat (limited to 'tests')
-rw-r--r--tests/Core/Command/Preview/RepairTest.php9
-rw-r--r--tests/Core/Controller/AppPasswordControllerTest.php10
-rw-r--r--tests/Core/Controller/ClientFlowLoginControllerTest.php14
3 files changed, 20 insertions, 13 deletions
diff --git a/tests/Core/Command/Preview/RepairTest.php b/tests/Core/Command/Preview/RepairTest.php
index 68f32c1f498..c37e57f848c 100644
--- a/tests/Core/Command/Preview/RepairTest.php
+++ b/tests/Core/Command/Preview/RepairTest.php
@@ -9,6 +9,7 @@ use OCP\Files\IRootFolder;
use OCP\Files\Node;
use OCP\IConfig;
use OCP\ILogger;
+use OCP\Lock\ILockingProvider;
use PHPUnit\Framework\MockObject\MockObject;
use Symfony\Component\Console\Formatter\OutputFormatterInterface;
use Symfony\Component\Console\Input\InputInterface;
@@ -43,7 +44,13 @@ class RepairTest extends TestCase {
->getMock();
$this->iniGetWrapper = $this->getMockBuilder(IniGetWrapper::class)
->getMock();
- $this->repair = new Repair($this->config, $this->rootFolder, $this->logger, $this->iniGetWrapper);
+ $this->repair = new Repair(
+ $this->config,
+ $this->rootFolder,
+ $this->logger,
+ $this->iniGetWrapper,
+ $this->createMock(ILockingProvider::class)
+ );
$this->input = $this->getMockBuilder(InputInterface::class)
->getMock();
$this->input->expects($this->any())
diff --git a/tests/Core/Controller/AppPasswordControllerTest.php b/tests/Core/Controller/AppPasswordControllerTest.php
index 91cf53bd585..7d81e0ec115 100644
--- a/tests/Core/Controller/AppPasswordControllerTest.php
+++ b/tests/Core/Controller/AppPasswordControllerTest.php
@@ -35,11 +35,11 @@ use OCP\Authentication\Exceptions\CredentialsUnavailableException;
use OCP\Authentication\Exceptions\PasswordUnavailableException;
use OCP\Authentication\LoginCredentials\ICredentials;
use OCP\Authentication\LoginCredentials\IStore;
+use OCP\EventDispatcher\IEventDispatcher;
use OCP\IRequest;
use OCP\ISession;
use OCP\Security\ISecureRandom;
use PHPUnit\Framework\MockObject\MockObject;
-use Symfony\Component\EventDispatcher\EventDispatcherInterface;
use Test\TestCase;
class AppPasswordControllerTest extends TestCase {
@@ -59,7 +59,7 @@ class AppPasswordControllerTest extends TestCase {
/** @var IRequest|MockObject */
private $request;
- /** @var EventDispatcherInterface|\PHPUnit\Framework\MockObject\MockObject */
+ /** @var IEventDispatcher|\PHPUnit\Framework\MockObject\MockObject */
private $eventDispatcher;
/** @var AppPasswordController */
@@ -73,7 +73,7 @@ class AppPasswordControllerTest extends TestCase {
$this->tokenProvider = $this->createMock(IProvider::class);
$this->credentialStore = $this->createMock(IStore::class);
$this->request = $this->createMock(IRequest::class);
- $this->eventDispatcher = $this->createMock(EventDispatcherInterface::class);
+ $this->eventDispatcher = $this->createMock(IEventDispatcher::class);
$this->controller = new AppPasswordController(
'core',
@@ -144,7 +144,7 @@ class AppPasswordControllerTest extends TestCase {
);
$this->eventDispatcher->expects($this->once())
- ->method('dispatch');
+ ->method('dispatchTyped');
$this->controller->getAppPassword();
}
@@ -185,7 +185,7 @@ class AppPasswordControllerTest extends TestCase {
);
$this->eventDispatcher->expects($this->once())
- ->method('dispatch');
+ ->method('dispatchTyped');
$this->controller->getAppPassword();
}
diff --git a/tests/Core/Controller/ClientFlowLoginControllerTest.php b/tests/Core/Controller/ClientFlowLoginControllerTest.php
index 037147e01b7..51a17743c93 100644
--- a/tests/Core/Controller/ClientFlowLoginControllerTest.php
+++ b/tests/Core/Controller/ClientFlowLoginControllerTest.php
@@ -32,6 +32,7 @@ use OCA\OAuth2\Db\ClientMapper;
use OCP\AppFramework\Http;
use OCP\AppFramework\Http\StandaloneTemplateResponse;
use OCP\Defaults;
+use OCP\EventDispatcher\IEventDispatcher;
use OCP\IL10N;
use OCP\IRequest;
use OCP\ISession;
@@ -41,7 +42,6 @@ use OCP\IUserSession;
use OCP\Security\ICrypto;
use OCP\Security\ISecureRandom;
use OCP\Session\Exceptions\SessionNotAvailableException;
-use Symfony\Component\EventDispatcher\EventDispatcherInterface;
use Test\TestCase;
class ClientFlowLoginControllerTest extends TestCase {
@@ -67,7 +67,7 @@ class ClientFlowLoginControllerTest extends TestCase {
private $accessTokenMapper;
/** @var ICrypto|\PHPUnit\Framework\MockObject\MockObject */
private $crypto;
- /** @var EventDispatcherInterface|\PHPUnit\Framework\MockObject\MockObject */
+ /** @var IEventDispatcher|\PHPUnit\Framework\MockObject\MockObject */
private $eventDispatcher;
@@ -94,7 +94,7 @@ class ClientFlowLoginControllerTest extends TestCase {
$this->clientMapper = $this->createMock(ClientMapper::class);
$this->accessTokenMapper = $this->createMock(AccessTokenMapper::class);
$this->crypto = $this->createMock(ICrypto::class);
- $this->eventDispatcher = $this->createMock(EventDispatcherInterface::class);
+ $this->eventDispatcher = $this->createMock(IEventDispatcher::class);
$this->clientFlowLoginController = new ClientFlowLoginController(
'core',
@@ -392,7 +392,7 @@ class ClientFlowLoginControllerTest extends TestCase {
->willReturn('');
$this->eventDispatcher->expects($this->once())
- ->method('dispatch');
+ ->method('dispatchTyped');
$expected = new Http\RedirectResponse('nc://login/server:http://example.com&user:MyLoginName&password:MyGeneratedToken');
$this->assertEquals($expected, $this->clientFlowLoginController->generateAppPassword('MyStateToken'));
@@ -488,7 +488,7 @@ class ClientFlowLoginControllerTest extends TestCase {
->willReturn($client);
$this->eventDispatcher->expects($this->once())
- ->method('dispatch');
+ ->method('dispatchTyped');
$expected = new Http\RedirectResponse($redirectUrl);
$this->assertEquals($expected, $this->clientFlowLoginController->generateAppPassword('MyStateToken', 'MyClientIdentifier'));
@@ -563,7 +563,7 @@ class ClientFlowLoginControllerTest extends TestCase {
->willReturn('');
$this->eventDispatcher->expects($this->once())
- ->method('dispatch');
+ ->method('dispatchTyped');
$expected = new Http\RedirectResponse('nc://login/server:http://example.com&user:MyLoginName&password:MyGeneratedToken');
$this->assertEquals($expected, $this->clientFlowLoginController->generateAppPassword('MyStateToken'));
@@ -694,7 +694,7 @@ class ClientFlowLoginControllerTest extends TestCase {
->willReturnMap($headers);
$this->eventDispatcher->expects($this->once())
- ->method('dispatch');
+ ->method('dispatchTyped');
$expected = new Http\RedirectResponse('nc://login/server:' . $expected . '://example.com&user:MyLoginName&password:MyGeneratedToken');
$this->assertEquals($expected, $this->clientFlowLoginController->generateAppPassword('MyStateToken'));