diff options
author | ArthurHoaro <arthur.hoareau@wizacha.com> | 2020-07-07 10:15:56 +0200 |
---|---|---|
committer | ArthurHoaro <arthur@hoa.ro> | 2020-07-23 21:19:21 +0200 |
commit | c4ad3d4f061d05a01db25aa54dda830ba776792d (patch) | |
tree | 691d91a5b0bbac62cee41f7b95ad1daa38d610b3 /tests/security/SessionManagerTest.php | |
parent | 1a8ac737e52cb25a5c346232ee398f5908cee7d7 (diff) | |
download | Shaarli-c4ad3d4f061d05a01db25aa54dda830ba776792d.tar.gz Shaarli-c4ad3d4f061d05a01db25aa54dda830ba776792d.tar.zst Shaarli-c4ad3d4f061d05a01db25aa54dda830ba776792d.zip |
Process Shaarli install through Slim controller
Diffstat (limited to 'tests/security/SessionManagerTest.php')
-rw-r--r-- | tests/security/SessionManagerTest.php | 14 |
1 files changed, 5 insertions, 9 deletions
diff --git a/tests/security/SessionManagerTest.php b/tests/security/SessionManagerTest.php index d9db775e..60695dcf 100644 --- a/tests/security/SessionManagerTest.php +++ b/tests/security/SessionManagerTest.php | |||
@@ -1,12 +1,8 @@ | |||
1 | <?php | 1 | <?php |
2 | require_once 'tests/utils/FakeConfigManager.php'; | ||
3 | 2 | ||
4 | // Initialize reference data _before_ PHPUnit starts a session | 3 | namespace Shaarli\Security; |
5 | require_once 'tests/utils/ReferenceSessionIdHashes.php'; | ||
6 | ReferenceSessionIdHashes::genAllHashes(); | ||
7 | 4 | ||
8 | use PHPUnit\Framework\TestCase; | 5 | use PHPUnit\Framework\TestCase; |
9 | use Shaarli\Security\SessionManager; | ||
10 | 6 | ||
11 | /** | 7 | /** |
12 | * Test coverage for SessionManager | 8 | * Test coverage for SessionManager |
@@ -30,7 +26,7 @@ class SessionManagerTest extends TestCase | |||
30 | */ | 26 | */ |
31 | public static function setUpBeforeClass() | 27 | public static function setUpBeforeClass() |
32 | { | 28 | { |
33 | self::$sidHashes = ReferenceSessionIdHashes::getHashes(); | 29 | self::$sidHashes = \ReferenceSessionIdHashes::getHashes(); |
34 | } | 30 | } |
35 | 31 | ||
36 | /** | 32 | /** |
@@ -38,13 +34,13 @@ class SessionManagerTest extends TestCase | |||
38 | */ | 34 | */ |
39 | public function setUp() | 35 | public function setUp() |
40 | { | 36 | { |
41 | $this->conf = new FakeConfigManager([ | 37 | $this->conf = new \FakeConfigManager([ |
42 | 'credentials.login' => 'johndoe', | 38 | 'credentials.login' => 'johndoe', |
43 | 'credentials.salt' => 'salt', | 39 | 'credentials.salt' => 'salt', |
44 | 'security.session_protection_disabled' => false, | 40 | 'security.session_protection_disabled' => false, |
45 | ]); | 41 | ]); |
46 | $this->session = []; | 42 | $this->session = []; |
47 | $this->sessionManager = new SessionManager($this->session, $this->conf); | 43 | $this->sessionManager = new SessionManager($this->session, $this->conf, 'session_path'); |
48 | } | 44 | } |
49 | 45 | ||
50 | /** | 46 | /** |
@@ -69,7 +65,7 @@ class SessionManagerTest extends TestCase | |||
69 | $token => 1, | 65 | $token => 1, |
70 | ], | 66 | ], |
71 | ]; | 67 | ]; |
72 | $sessionManager = new SessionManager($session, $this->conf); | 68 | $sessionManager = new SessionManager($session, $this->conf, 'session_path'); |
73 | 69 | ||
74 | // check and destroy the token | 70 | // check and destroy the token |
75 | $this->assertTrue($sessionManager->checkToken($token)); | 71 | $this->assertTrue($sessionManager->checkToken($token)); |