diff options
author | Daniel Rudolf <github.com@daniel-rudolf.de> | 2021-06-30 16:16:05 +0200 |
---|---|---|
committer | Daniel Rudolf <github.com@daniel-rudolf.de> | 2021-06-30 16:20:57 +0200 |
commit | 12059eb65b5f72974aab05f81ded890ebd73daab (patch) | |
tree | 7da1e4baa80a27ccda958beeb8636aa3dc381102 /tests/Core/Controller | |
parent | 75f7287b5ed7251599fd6c67ff3ae319f6a3dfc2 (diff) | |
download | nextcloud-server-12059eb65b5f72974aab05f81ded890ebd73daab.tar.gz nextcloud-server-12059eb65b5f72974aab05f81ded890ebd73daab.zip |
Add IUrlGenerator::linkToDefaultPageUrl()
Replaces the deprecated \OC_Util::getDefaultPageUrl() and makes this API public.
Signed-off-by: Daniel Rudolf <github.com@daniel-rudolf.de>
Diffstat (limited to 'tests/Core/Controller')
-rw-r--r-- | tests/Core/Controller/LoginControllerTest.php | 17 | ||||
-rw-r--r-- | tests/Core/Controller/TwoFactorChallengeControllerTest.php | 3 |
2 files changed, 10 insertions, 10 deletions
diff --git a/tests/Core/Controller/LoginControllerTest.php b/tests/Core/Controller/LoginControllerTest.php index e3469621eec..2f964817e7d 100644 --- a/tests/Core/Controller/LoginControllerTest.php +++ b/tests/Core/Controller/LoginControllerTest.php @@ -29,6 +29,7 @@ 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,7 +213,7 @@ class LoginControllerTest extends TestCase { ->method('isLoggedIn') ->willReturn(true); - $expectedResponse = new RedirectResponse(\OC_Util::getDefaultPageUrl()); + $expectedResponse = new RedirectToDefaultAppResponse(); $this->assertEquals($expectedResponse, $this->loginController->showLoginForm('', '', '')); } @@ -443,7 +444,7 @@ class LoginControllerTest extends TestCase { 'direct' => 1, ]) ->willReturn($loginPageUrl); - $expected = new \OCP\AppFramework\Http\RedirectResponse($loginPageUrl); + $expected = new RedirectResponse($loginPageUrl); $expected->throttle(['user' => 'MyUserName']); $response = $this->loginController->tryLogin($user, $password, '/apps/files'); @@ -454,7 +455,6 @@ class LoginControllerTest extends TestCase { public function testLoginWithValidCredentials() { $user = 'MyUserName'; $password = 'secret'; - $indexPageUrl = \OC_Util::getDefaultPageUrl(); $this->request ->expects($this->once()) @@ -470,7 +470,7 @@ class LoginControllerTest extends TestCase { ->method('process') ->with($this->equalTo($loginData)) ->willReturn($loginResult); - $expected = new \OCP\AppFramework\Http\RedirectResponse($indexPageUrl); + $expected = new RedirectToDefaultAppResponse(); $response = $this->loginController->tryLogin($user, $password); @@ -499,7 +499,7 @@ class LoginControllerTest extends TestCase { $this->userSession->expects($this->never()) ->method('createRememberMeToken'); - $expected = new \OCP\AppFramework\Http\RedirectResponse(\OC_Util::getDefaultPageUrl()); + $expected = new RedirectToDefaultAppResponse(); $this->assertEquals($expected, $this->loginController->tryLogin('Jane', $password, $originalUrl)); } @@ -534,14 +534,13 @@ class LoginControllerTest extends TestCase { ->with('remember_login_cookie_lifetime') ->willReturn(1234); - $expected = new \OCP\AppFramework\Http\RedirectResponse($redirectUrl); + $expected = new RedirectResponse($redirectUrl); $this->assertEquals($expected, $this->loginController->tryLogin('Jane', $password, $originalUrl)); } public function testLoginWithValidCredentialsAndRedirectUrl() { $user = 'MyUserName'; $password = 'secret'; - $indexPageUrl = \OC_Util::getDefaultPageUrl(); $redirectUrl = 'https://next.cloud/apps/mail'; $this->request @@ -566,7 +565,7 @@ class LoginControllerTest extends TestCase { ->method('getAbsoluteURL') ->with('/apps/mail') ->willReturn($redirectUrl); - $expected = new \OCP\AppFramework\Http\RedirectResponse($redirectUrl); + $expected = new RedirectResponse($redirectUrl); $response = $this->loginController->tryLogin($user, $password, '/apps/mail'); @@ -601,7 +600,7 @@ class LoginControllerTest extends TestCase { 'direct' => 1, ]) ->willReturn($loginPageUrl); - $expected = new \OCP\AppFramework\Http\RedirectResponse($loginPageUrl); + $expected = new RedirectResponse($loginPageUrl); $expected->throttle(['user' => 'john']); $response = $this->loginController->tryLogin( diff --git a/tests/Core/Controller/TwoFactorChallengeControllerTest.php b/tests/Core/Controller/TwoFactorChallengeControllerTest.php index 1a2a4d8eaa5..f3e4ec5628e 100644 --- a/tests/Core/Controller/TwoFactorChallengeControllerTest.php +++ b/tests/Core/Controller/TwoFactorChallengeControllerTest.php @@ -27,6 +27,7 @@ use OC\Authentication\TwoFactorAuth\ProviderSet; use OC\Core\Controller\TwoFactorChallengeController; use OC_Util; 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; @@ -208,7 +209,7 @@ class TwoFactorChallengeControllerTest extends TestCase { ->with('myprovider', $user, 'token') ->willReturn(true); - $expected = new RedirectResponse(OC_Util::getDefaultPageUrl()); + $expected = new RedirectToDefaultAppResponse(); $this->assertEquals($expected, $this->controller->solveChallenge('myprovider', 'token')); } |