summaryrefslogtreecommitdiffstats
path: root/tests
diff options
context:
space:
mode:
authorDaniel Kesselberg <mail@danielkesselberg.de>2019-11-12 21:48:56 +0100
committerDaniel Kesselberg <mail@danielkesselberg.de>2019-11-30 15:17:22 +0100
commit9378a6b4111f5ae600aa04f6a6d273b07c53c78a (patch)
tree4b884c8c50445ae07097237742ed97c16636fe70 /tests
parent6725a4b746382a7ebc72e7e70539954cd450240a (diff)
downloadnextcloud-server-9378a6b4111f5ae600aa04f6a6d273b07c53c78a.tar.gz
nextcloud-server-9378a6b4111f5ae600aa04f6a6d273b07c53c78a.zip
Send Clear-Site-Data expect for Chrome
Signed-off-by: Daniel Kesselberg <mail@danielkesselberg.de>
Diffstat (limited to 'tests')
-rw-r--r--tests/Core/Controller/LoginControllerTest.php28
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())