diff options
author | VirtualTam <virtualtam@flibidi.net> | 2017-10-24 22:01:02 +0200 |
---|---|---|
committer | VirtualTam <virtualtam@flibidi.net> | 2017-10-24 22:01:02 +0200 |
commit | ae7c954b1279981cc23c9f67d88f55bfecc4d828 (patch) | |
tree | 84935f944b97666d3413a7304d295893d692c0f5 /tests/SessionManagerTest.php | |
parent | fd7d84616d53486c3a276a42da869390e1d7f5eb (diff) | |
download | Shaarli-ae7c954b1279981cc23c9f67d88f55bfecc4d828.tar.gz Shaarli-ae7c954b1279981cc23c9f67d88f55bfecc4d828.tar.zst Shaarli-ae7c954b1279981cc23c9f67d88f55bfecc4d828.zip |
Improve SessionManager tests
Signed-off-by: VirtualTam <virtualtam@flibidi.net>
Diffstat (limited to 'tests/SessionManagerTest.php')
-rw-r--r-- | tests/SessionManagerTest.php | 23 |
1 files changed, 23 insertions, 0 deletions
diff --git a/tests/SessionManagerTest.php b/tests/SessionManagerTest.php index 9fa60dc5..a92c3ccc 100644 --- a/tests/SessionManagerTest.php +++ b/tests/SessionManagerTest.php | |||
@@ -51,6 +51,29 @@ class SessionManagerTest extends TestCase | |||
51 | } | 51 | } |
52 | 52 | ||
53 | /** | 53 | /** |
54 | * Check a session token | ||
55 | */ | ||
56 | public function testCheckToken() | ||
57 | { | ||
58 | $token = '4dccc3a45ad9d03e5542b90c37d8db6d10f2b38b'; | ||
59 | $session = [ | ||
60 | 'tokens' => [ | ||
61 | $token => 1, | ||
62 | ], | ||
63 | ]; | ||
64 | $conf = new FakeConfigManager(); | ||
65 | $sessionManager = new SessionManager($session, $conf); | ||
66 | |||
67 | |||
68 | // check and destroy the token | ||
69 | $this->assertTrue($sessionManager->checkToken($token)); | ||
70 | $this->assertFalse(isset($session['tokens'][$token])); | ||
71 | |||
72 | // ensure the token has been destroyed | ||
73 | $this->assertFalse($sessionManager->checkToken($token)); | ||
74 | } | ||
75 | |||
76 | /** | ||
54 | * Generate and check a session token | 77 | * Generate and check a session token |
55 | */ | 78 | */ |
56 | public function testGenerateAndCheckToken() | 79 | public function testGenerateAndCheckToken() |