diff options
author | Roeland Jago Douma <rullzer@users.noreply.github.com> | 2019-12-12 21:59:42 +0100 |
---|---|---|
committer | GitHub <noreply@github.com> | 2019-12-12 21:59:42 +0100 |
commit | 87104ce5100f905dab3ce056f05847fad5dde393 (patch) | |
tree | 13ed0038cd67a4f4cb1c61fa81dca4f019d74eb6 /tests/Core | |
parent | 815241fa09615efbd1fa2b66d5a9bfb7c4e76298 (diff) | |
parent | 9378a6b4111f5ae600aa04f6a6d273b07c53c78a (diff) | |
download | nextcloud-server-87104ce5100f905dab3ce056f05847fad5dde393.tar.gz nextcloud-server-87104ce5100f905dab3ce056f05847fad5dde393.zip |
Merge pull request #17784 from nextcloud/enh/disable-clear-site-data-via-config
Disable Clear-Site-Data for Chrom* (and Opera, Brave, etc)
Diffstat (limited to 'tests/Core')
-rw-r--r-- | tests/Core/Controller/LoginControllerTest.php | 28 |
1 files changed, 28 insertions, 0 deletions
diff --git a/tests/Core/Controller/LoginControllerTest.php b/tests/Core/Controller/LoginControllerTest.php index b4f3663c0ba..6a6795a8e82 100644 --- a/tests/Core/Controller/LoginControllerTest.php +++ b/tests/Core/Controller/LoginControllerTest.php @@ -128,6 +128,10 @@ class LoginControllerTest extends TestCase { ->method('getCookie') ->with('nc_token') ->willReturn(null); + $this->request + ->expects($this->once()) + ->method('isUserAgent') + ->willReturn(false); $this->config ->expects($this->never()) ->method('deleteUserValue'); @@ -142,12 +146,36 @@ 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()) ->method('getCookie') ->with('nc_token') ->willReturn('MyLoginToken'); + $this->request + ->expects($this->once()) + ->method('isUserAgent') + ->willReturn(false); $user = $this->createMock(IUser::class); $user ->expects($this->once()) |