@@ -143,8 +143,9 @@ public function testLogoutWithoutToken() {
143143 ->with ('nc_token ' )
144144 ->willReturn (null );
145145 $ this ->request
146- ->method ('getServerProtocol ' )
147- ->willReturn ('https ' );
146+ ->expects ($ this ->once ())
147+ ->method ('isUserAgent ' )
148+ ->willReturn (false );
148149 $ this ->config
149150 ->expects ($ this ->never ())
150151 ->method ('deleteUserValue ' );
@@ -159,6 +160,26 @@ public function testLogoutWithoutToken() {
159160 $ this ->assertEquals ($ expected , $ this ->loginController ->logout ());
160161 }
161162
163+ public function testLogoutNoClearSiteData () {
164+ $ this ->request
165+ ->expects ($ this ->once ())
166+ ->method ('getCookie ' )
167+ ->with ('nc_token ' )
168+ ->willReturn (null );
169+ $ this ->request
170+ ->expects ($ this ->once ())
171+ ->method ('isUserAgent ' )
172+ ->willReturn (true );
173+ $ this ->urlGenerator
174+ ->expects ($ this ->once ())
175+ ->method ('linkToRouteAbsolute ' )
176+ ->with ('core.login.showLoginForm ' )
177+ ->willReturn ('/login ' );
178+
179+ $ expected = new RedirectResponse ('/login ' );
180+ $ this ->assertEquals ($ expected , $ this ->loginController ->logout ());
181+ }
182+
162183 public function testLogoutWithToken () {
163184 $ this ->request
164185 ->expects ($ this ->once ())
@@ -167,8 +188,8 @@ public function testLogoutWithToken() {
167188 ->willReturn ('MyLoginToken ' );
168189 $ this ->request
169190 ->expects ($ this ->once ())
170- ->method ('getServerProtocol ' )
171- ->willReturn (' https ' );
191+ ->method ('isUserAgent ' )
192+ ->willReturn (false );
172193 $ user = $ this ->createMock (IUser::class);
173194 $ user
174195 ->expects ($ this ->once ())
0 commit comments