diff options
author | Gaspard d'Hautefeuille <github@dhautefeuille.eu> | 2024-01-02 10:52:46 +0200 |
---|---|---|
committer | Simon L <szaimen@e.mail.de> | 2024-01-05 04:20:26 +0100 |
commit | 85911cbab256ce10eb5a9149ae8351feb99dfe59 (patch) | |
tree | 001b519ce6c777dcc5a7704bbdf0597aa41a7536 /tests/Core | |
parent | 7502c19ddd43853c3b4fad1e2df91aed19e6b626 (diff) | |
download | nextcloud-server-85911cbab256ce10eb5a9149ae8351feb99dfe59.tar.gz nextcloud-server-85911cbab256ce10eb5a9149ae8351feb99dfe59.zip |
Cancel PR #37405, remove regression code
Signed-off-by: Gaspard d'Hautefeuille <github@dhautefeuille.eu>
Diffstat (limited to 'tests/Core')
-rw-r--r-- | tests/Core/Controller/LoginControllerTest.php | 29 |
1 files changed, 25 insertions, 4 deletions
diff --git a/tests/Core/Controller/LoginControllerTest.php b/tests/Core/Controller/LoginControllerTest.php index 7d82e256c17..b427972e1ad 100644 --- a/tests/Core/Controller/LoginControllerTest.php +++ b/tests/Core/Controller/LoginControllerTest.php @@ -143,8 +143,9 @@ class LoginControllerTest extends TestCase { ->with('nc_token') ->willReturn(null); $this->request - ->method('getServerProtocol') - ->willReturn('https'); + ->expects($this->once()) + ->method('isUserAgent') + ->willReturn(false); $this->config ->expects($this->never()) ->method('deleteUserValue'); @@ -159,6 +160,26 @@ class LoginControllerTest extends TestCase { $this->assertEquals($expected, $this->loginController->logout()); } + public function testLogoutNoClearSiteData() { + $this->request + ->expects($this->once()) + ->method('getCookie') + ->with('nc_token') + ->willReturn(null); + $this->request + ->expects($this->once()) + ->method('isUserAgent') + ->willReturn(true); + $this->urlGenerator + ->expects($this->once()) + ->method('linkToRouteAbsolute') + ->with('core.login.showLoginForm') + ->willReturn('/login'); + + $expected = new RedirectResponse('/login'); + $this->assertEquals($expected, $this->loginController->logout()); + } + public function testLogoutWithToken() { $this->request ->expects($this->once()) @@ -167,8 +188,8 @@ class LoginControllerTest extends TestCase { ->willReturn('MyLoginToken'); $this->request ->expects($this->once()) - ->method('getServerProtocol') - ->willReturn('https'); + ->method('isUserAgent') + ->willReturn(false); $user = $this->createMock(IUser::class); $user ->expects($this->once()) |