diff options
author | Marius Meissner <marius.meissner@sixt.com> | 2018-05-23 13:13:13 +0300 |
---|---|---|
committer | Marius Meissner <marius.meissner@sixt.com> | 2018-05-23 13:13:13 +0300 |
commit | 21436f61dd969350a75817a70f4678edc70bad29 (patch) | |
tree | 868a0522338f1a8aee25612c1b99a67a9c96f49a /tests | |
parent | e2d5b5ea495b93e40392b6c694cb240f2a4dd486 (diff) |
PHPREDIS-1354: Added session lifetime parameter for reading session data
Diffstat (limited to 'tests')
-rw-r--r-- | tests/RedisTest.php | 7 | ||||
-rw-r--r-- | tests/getSessionData.php | 2 |
2 files changed, 6 insertions, 3 deletions
diff --git a/tests/RedisTest.php b/tests/RedisTest.php index da4e2523..03db4fc7 100644 --- a/tests/RedisTest.php +++ b/tests/RedisTest.php @@ -5493,7 +5493,7 @@ class Redis_Test extends TestSuite $sessionId = $this->generateSessionId(); $this->startSessionProcess($sessionId, 0, false, 300, true, null, -1, 0, 'test', 600); $this->redis->expire($this->sessionPrefix . $sessionId, 9999); - $this->getSessionData($sessionId); + $this->getSessionData($sessionId, 600); $ttl = $this->redis->ttl($this->sessionPrefix . $sessionId); $this->assertEquals(600, $ttl); @@ -5565,12 +5565,13 @@ class Redis_Test extends TestSuite /** * @param string $sessionId + * @param int $sessionLifetime * * @return string */ - private function getSessionData($sessionId) + private function getSessionData($sessionId, $sessionLifetime = 1440) { - $command = 'php ' . __DIR__ . '/getSessionData.php ' . escapeshellarg($this->getHost()) . ' ' . escapeshellarg($sessionId); + $command = 'php ' . __DIR__ . '/getSessionData.php ' . escapeshellarg($this->getHost()) . ' ' . escapeshellarg($sessionId) . ' ' . escapeshellarg($sessionLifetime); exec($command, $output); return $output[0]; diff --git a/tests/getSessionData.php b/tests/getSessionData.php index b5bea74a..587fdd26 100644 --- a/tests/getSessionData.php +++ b/tests/getSessionData.php @@ -3,6 +3,7 @@ error_reporting(E_ERROR | E_WARNING); $redisHost = $argv[1]; $sessionId = $argv[2]; +$sessionLifetime = $argv[3]; if (empty($redisHost)) { $redisHost = 'localhost'; @@ -10,6 +11,7 @@ if (empty($redisHost)) { ini_set('session.save_handler', 'redis'); ini_set('session.save_path', 'tcp://' . $redisHost . ':6379'); +ini_set('session.gc_maxlifetime', $sessionLifetime); session_id($sessionId); if (!session_start()) { |