aboutsummaryrefslogtreecommitdiffhomepage
path: root/tests/security/LoginManagerTest.php
diff options
context:
space:
mode:
Diffstat (limited to 'tests/security/LoginManagerTest.php')
-rw-r--r--tests/security/LoginManagerTest.php15
1 files changed, 10 insertions, 5 deletions
diff --git a/tests/security/LoginManagerTest.php b/tests/security/LoginManagerTest.php
index fad09992..f26cd1eb 100644
--- a/tests/security/LoginManagerTest.php
+++ b/tests/security/LoginManagerTest.php
@@ -84,10 +84,7 @@ class LoginManagerTest extends TestCase
84 $this->globals = &$GLOBALS; 84 $this->globals = &$GLOBALS;
85 unset($this->globals['IPBANS']); 85 unset($this->globals['IPBANS']);
86 86
87 $this->session = [ 87 $this->session = [];
88 'expires_on' => time() + 100,
89 'ip' => $this->clientIpAddress,
90 ];
91 88
92 $this->sessionManager = new SessionManager($this->session, $this->configManager); 89 $this->sessionManager = new SessionManager($this->session, $this->configManager);
93 $this->loginManager = new LoginManager($this->globals, $this->configManager, $this->sessionManager); 90 $this->loginManager = new LoginManager($this->globals, $this->configManager, $this->sessionManager);
@@ -281,12 +278,18 @@ class LoginManagerTest extends TestCase
281 */ 278 */
282 public function testCheckLoginStateStaySignedInWithInvalidToken() 279 public function testCheckLoginStateStaySignedInWithInvalidToken()
283 { 280 {
281 // simulate a previous login
282 $this->session = [
283 'ip' => $this->clientIpAddress,
284 'expires_on' => time() + 100,
285 ];
284 $this->loginManager->generateStaySignedInToken($this->clientIpAddress); 286 $this->loginManager->generateStaySignedInToken($this->clientIpAddress);
285 $this->cookie[LoginManager::$STAY_SIGNED_IN_COOKIE] = 'nope'; 287 $this->cookie[LoginManager::$STAY_SIGNED_IN_COOKIE] = 'nope';
286 288
287 $this->loginManager->checkLoginState($this->cookie, $this->clientIpAddress); 289 $this->loginManager->checkLoginState($this->cookie, $this->clientIpAddress);
288 290
289 $this->assertFalse($this->loginManager->isLoggedIn()); 291 $this->assertTrue($this->loginManager->isLoggedIn());
292 $this->assertTrue(empty($this->session['username']));
290 } 293 }
291 294
292 /** 295 /**
@@ -300,6 +303,8 @@ class LoginManagerTest extends TestCase
300 $this->loginManager->checkLoginState($this->cookie, $this->clientIpAddress); 303 $this->loginManager->checkLoginState($this->cookie, $this->clientIpAddress);
301 304
302 $this->assertTrue($this->loginManager->isLoggedIn()); 305 $this->assertTrue($this->loginManager->isLoggedIn());
306 $this->assertEquals($this->login, $this->session['username']);
307 $this->assertEquals($this->clientIpAddress, $this->session['ip']);
303 } 308 }
304 309
305 /** 310 /**