Skip to content

Commit bb7ff7f

Browse files
committed
Revert controller tests to match stable21 API
Signed-off-by: Vincent Petry <vincent@nextcloud.com>
1 parent 447ccc1 commit bb7ff7f

File tree

2 files changed

+12
-12
lines changed

2 files changed

+12
-12
lines changed

tests/Core/Controller/AppPasswordControllerTest.php

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -35,11 +35,11 @@
3535
use OCP\Authentication\Exceptions\PasswordUnavailableException;
3636
use OCP\Authentication\LoginCredentials\ICredentials;
3737
use OCP\Authentication\LoginCredentials\IStore;
38-
use OCP\EventDispatcher\IEventDispatcher;
3938
use OCP\IRequest;
4039
use OCP\ISession;
4140
use OCP\Security\ISecureRandom;
4241
use PHPUnit\Framework\MockObject\MockObject;
42+
use Symfony\Component\EventDispatcher\EventDispatcherInterface;
4343
use Test\TestCase;
4444

4545
class AppPasswordControllerTest extends TestCase {
@@ -59,7 +59,7 @@ class AppPasswordControllerTest extends TestCase {
5959
/** @var IRequest|MockObject */
6060
private $request;
6161

62-
/** @var IEventDispatcher|\PHPUnit\Framework\MockObject\MockObject */
62+
/** @var EventDispatcherInterface|\PHPUnit\Framework\MockObject\MockObject */
6363
private $eventDispatcher;
6464

6565
/** @var AppPasswordController */
@@ -73,7 +73,7 @@ protected function setUp(): void {
7373
$this->tokenProvider = $this->createMock(IProvider::class);
7474
$this->credentialStore = $this->createMock(IStore::class);
7575
$this->request = $this->createMock(IRequest::class);
76-
$this->eventDispatcher = $this->createMock(IEventDispatcher::class);
76+
$this->eventDispatcher = $this->createMock(EventDispatcherInterface::class);
7777

7878
$this->controller = new AppPasswordController(
7979
'core',
@@ -144,7 +144,7 @@ public function testGetAppPassword() {
144144
);
145145

146146
$this->eventDispatcher->expects($this->once())
147-
->method('dispatchTyped');
147+
->method('dispatch');
148148

149149
$this->controller->getAppPassword();
150150
}
@@ -185,7 +185,7 @@ public function testGetAppPasswordNoPassword() {
185185
);
186186

187187
$this->eventDispatcher->expects($this->once())
188-
->method('dispatchTyped');
188+
->method('dispatch');
189189

190190
$this->controller->getAppPassword();
191191
}

tests/Core/Controller/ClientFlowLoginControllerTest.php

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -32,7 +32,6 @@
3232
use OCP\AppFramework\Http;
3333
use OCP\AppFramework\Http\StandaloneTemplateResponse;
3434
use OCP\Defaults;
35-
use OCP\EventDispatcher\IEventDispatcher;
3635
use OCP\IL10N;
3736
use OCP\IRequest;
3837
use OCP\ISession;
@@ -42,6 +41,7 @@
4241
use OCP\Security\ICrypto;
4342
use OCP\Security\ISecureRandom;
4443
use OCP\Session\Exceptions\SessionNotAvailableException;
44+
use Symfony\Component\EventDispatcher\EventDispatcherInterface;
4545
use Test\TestCase;
4646

4747
class ClientFlowLoginControllerTest extends TestCase {
@@ -67,7 +67,7 @@ class ClientFlowLoginControllerTest extends TestCase {
6767
private $accessTokenMapper;
6868
/** @var ICrypto|\PHPUnit\Framework\MockObject\MockObject */
6969
private $crypto;
70-
/** @var IEventDispatcher|\PHPUnit\Framework\MockObject\MockObject */
70+
/** @var EventDispatcherInterface|\PHPUnit\Framework\MockObject\MockObject */
7171
private $eventDispatcher;
7272

7373

@@ -94,7 +94,7 @@ protected function setUp(): void {
9494
$this->clientMapper = $this->createMock(ClientMapper::class);
9595
$this->accessTokenMapper = $this->createMock(AccessTokenMapper::class);
9696
$this->crypto = $this->createMock(ICrypto::class);
97-
$this->eventDispatcher = $this->createMock(IEventDispatcher::class);
97+
$this->eventDispatcher = $this->createMock(EventDispatcherInterface::class);
9898

9999
$this->clientFlowLoginController = new ClientFlowLoginController(
100100
'core',
@@ -392,7 +392,7 @@ public function testGeneratePasswordWithPassword() {
392392
->willReturn('');
393393

394394
$this->eventDispatcher->expects($this->once())
395-
->method('dispatchTyped');
395+
->method('dispatch');
396396

397397
$expected = new Http\RedirectResponse('nc://login/server:http://example.com&user:MyLoginName&password:MyGeneratedToken');
398398
$this->assertEquals($expected, $this->clientFlowLoginController->generateAppPassword('MyStateToken'));
@@ -488,7 +488,7 @@ public function testGeneratePasswordWithPasswordForOauthClient($redirectUri, $re
488488
->willReturn($client);
489489

490490
$this->eventDispatcher->expects($this->once())
491-
->method('dispatchTyped');
491+
->method('dispatch');
492492

493493
$expected = new Http\RedirectResponse($redirectUrl);
494494
$this->assertEquals($expected, $this->clientFlowLoginController->generateAppPassword('MyStateToken', 'MyClientIdentifier'));
@@ -563,7 +563,7 @@ public function testGeneratePasswordWithoutPassword() {
563563
->willReturn('');
564564

565565
$this->eventDispatcher->expects($this->once())
566-
->method('dispatchTyped');
566+
->method('dispatch');
567567

568568
$expected = new Http\RedirectResponse('nc://login/server:http://example.com&user:MyLoginName&password:MyGeneratedToken');
569569
$this->assertEquals($expected, $this->clientFlowLoginController->generateAppPassword('MyStateToken'));
@@ -694,7 +694,7 @@ public function testGeneratePasswordWithHttpsProxy(array $headers, $protocol, $e
694694
->willReturnMap($headers);
695695

696696
$this->eventDispatcher->expects($this->once())
697-
->method('dispatchTyped');
697+
->method('dispatch');
698698

699699
$expected = new Http\RedirectResponse('nc://login/server:' . $expected . '://example.com&user:MyLoginName&password:MyGeneratedToken');
700700
$this->assertEquals($expected, $this->clientFlowLoginController->generateAppPassword('MyStateToken'));

0 commit comments

Comments
 (0)