aboutsummaryrefslogtreecommitdiffstats
path: root/tests/Core
diff options
context:
space:
mode:
authorDaniel Rudolf <github.com@daniel-rudolf.de>2021-07-01 15:13:08 +0200
committerDaniel Rudolf <github.com@daniel-rudolf.de>2021-07-01 15:13:08 +0200
commite478db9161990d004d42dbae07436d6e881fc137 (patch)
tree94c037b635b1179cc711927703d65f0ea5fc418a /tests/Core
parent2c7186a15f81d084617b43e5cfbf9c6c34189667 (diff)
downloadnextcloud-server-e478db9161990d004d42dbae07436d6e881fc137.tar.gz
nextcloud-server-e478db9161990d004d42dbae07436d6e881fc137.zip
Deprecate RedirectToDefaultAppResponse
Signed-off-by: Daniel Rudolf <github.com@daniel-rudolf.de>
Diffstat (limited to 'tests/Core')
-rw-r--r--tests/Core/Controller/LoginControllerTest.php23
-rw-r--r--tests/Core/Controller/TwoFactorChallengeControllerTest.php7
2 files changed, 21 insertions, 9 deletions
diff --git a/tests/Core/Controller/LoginControllerTest.php b/tests/Core/Controller/LoginControllerTest.php
index 2f964817e7d..fe42b55db15 100644
--- a/tests/Core/Controller/LoginControllerTest.php
+++ b/tests/Core/Controller/LoginControllerTest.php
@@ -29,7 +29,6 @@ use OC\Core\Controller\LoginController;
use OC\Security\Bruteforce\Throttler;
use OC\User\Session;
use OCP\AppFramework\Http\RedirectResponse;
-use OCP\AppFramework\Http\RedirectToDefaultAppResponse;
use OCP\AppFramework\Http\TemplateResponse;
use OCP\Defaults;
use OCP\IConfig;
@@ -212,8 +211,12 @@ class LoginControllerTest extends TestCase {
->expects($this->once())
->method('isLoggedIn')
->willReturn(true);
+ $this->urlGenerator
+ ->expects($this->once())
+ ->method('linkToDefaultPageUrl')
+ ->willReturn('/default/foo');
- $expectedResponse = new RedirectToDefaultAppResponse();
+ $expectedResponse = new RedirectResponse('/default/foo');
$this->assertEquals($expectedResponse, $this->loginController->showLoginForm('', '', ''));
}
@@ -470,11 +473,13 @@ class LoginControllerTest extends TestCase {
->method('process')
->with($this->equalTo($loginData))
->willReturn($loginResult);
- $expected = new RedirectToDefaultAppResponse();
-
- $response = $this->loginController->tryLogin($user, $password);
+ $this->urlGenerator
+ ->expects($this->once())
+ ->method('linkToDefaultPageUrl')
+ ->willReturn('/default/foo');
- $this->assertEquals($expected, $response);
+ $expected = new RedirectResponse('/default/foo');
+ $this->assertEquals($expected, $this->loginController->tryLogin($user, $password));
}
public function testLoginWithoutPassedCsrfCheckAndNotLoggedIn() {
@@ -498,8 +503,12 @@ class LoginControllerTest extends TestCase {
->method('deleteUserValue');
$this->userSession->expects($this->never())
->method('createRememberMeToken');
+ $this->urlGenerator
+ ->expects($this->once())
+ ->method('linkToDefaultPageUrl')
+ ->willReturn('/default/foo');
- $expected = new RedirectToDefaultAppResponse();
+ $expected = new RedirectResponse('/default/foo');
$this->assertEquals($expected, $this->loginController->tryLogin('Jane', $password, $originalUrl));
}
diff --git a/tests/Core/Controller/TwoFactorChallengeControllerTest.php b/tests/Core/Controller/TwoFactorChallengeControllerTest.php
index 20ddfa5075b..1b5042722e5 100644
--- a/tests/Core/Controller/TwoFactorChallengeControllerTest.php
+++ b/tests/Core/Controller/TwoFactorChallengeControllerTest.php
@@ -26,7 +26,6 @@ use OC\Authentication\TwoFactorAuth\Manager;
use OC\Authentication\TwoFactorAuth\ProviderSet;
use OC\Core\Controller\TwoFactorChallengeController;
use OCP\AppFramework\Http\RedirectResponse;
-use OCP\AppFramework\Http\RedirectToDefaultAppResponse;
use OCP\AppFramework\Http\StandaloneTemplateResponse;
use OCP\Authentication\TwoFactorAuth\IActivatableAtLogin;
use OCP\Authentication\TwoFactorAuth\ILoginSetupProvider;
@@ -207,8 +206,12 @@ class TwoFactorChallengeControllerTest extends TestCase {
->method('verifyChallenge')
->with('myprovider', $user, 'token')
->willReturn(true);
+ $this->urlGenerator
+ ->expects($this->once())
+ ->method('linkToDefaultPageUrl')
+ ->willReturn('/default/foo');
- $expected = new RedirectToDefaultAppResponse();
+ $expected = new RedirectResponse('/default/foo');
$this->assertEquals($expected, $this->controller->solveChallenge('myprovider', 'token'));
}