From ae7c954b1279981cc23c9f67d88f55bfecc4d828 Mon Sep 17 00:00:00 2001 From: VirtualTam Date: Tue, 24 Oct 2017 22:01:02 +0200 Subject: Improve SessionManager tests Signed-off-by: VirtualTam --- tests/SessionManagerTest.php | 23 +++++++++++++++++++++++ 1 file changed, 23 insertions(+) (limited to 'tests') diff --git a/tests/SessionManagerTest.php b/tests/SessionManagerTest.php index 9fa60dc5..a92c3ccc 100644 --- a/tests/SessionManagerTest.php +++ b/tests/SessionManagerTest.php @@ -50,6 +50,29 @@ class SessionManagerTest extends TestCase $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 */ -- cgit v1.2.3