Improve SessionManager tests
Signed-off-by: VirtualTam <virtualtam@flibidi.net>
This commit is contained in:
parent
fd7d84616d
commit
ae7c954b12
1 changed files with 23 additions and 0 deletions
|
@ -50,6 +50,29 @@ public function testGenerateToken()
|
||||||
$this->assertEquals(40, strlen($token));
|
$this->assertEquals(40, strlen($token));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Check a session token
|
||||||
|
*/
|
||||||
|
public function testCheckToken()
|
||||||
|
{
|
||||||
|
$token = '4dccc3a45ad9d03e5542b90c37d8db6d10f2b38b';
|
||||||
|
$session = [
|
||||||
|
'tokens' => [
|
||||||
|
$token => 1,
|
||||||
|
],
|
||||||
|
];
|
||||||
|
$conf = new FakeConfigManager();
|
||||||
|
$sessionManager = new SessionManager($session, $conf);
|
||||||
|
|
||||||
|
|
||||||
|
// check and destroy the token
|
||||||
|
$this->assertTrue($sessionManager->checkToken($token));
|
||||||
|
$this->assertFalse(isset($session['tokens'][$token]));
|
||||||
|
|
||||||
|
// ensure the token has been destroyed
|
||||||
|
$this->assertFalse($sessionManager->checkToken($token));
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Generate and check a session token
|
* Generate and check a session token
|
||||||
*/
|
*/
|
||||||
|
|
Loading…
Reference in a new issue