|
|
|
@ -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())
|
|
|
|
|