Skip to content

Commit 685f776

Browse files
committed
Added ability to set a lifeTim during session init and added tests.
1 parent c04545f commit 685f776

File tree

2 files changed

+15
-2
lines changed

2 files changed

+15
-2
lines changed

src/Session.php

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -61,10 +61,10 @@ public static function getPrefix()
6161
*
6262
* @return bool
6363
*/
64-
public static function init($LifeTime = 0)
64+
public static function init($lifeTime = 0)
6565
{
6666
if (self::$sessionStarted == false) {
67-
session_set_cookie_params($LifeTime);
67+
session_set_cookie_params($lifeTime);
6868
session_start();
6969

7070
return self::$sessionStarted = true;

tests/SessionTest.php

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -85,6 +85,19 @@ public function testInit()
8585
$this->assertTrue($session::init());
8686
$this->assertFalse($session::init());
8787
}
88+
89+
/**
90+
* Start session with a max lifetime.
91+
*
92+
* @runInSeparateProcess
93+
*/
94+
public function testInitLifeTime()
95+
{
96+
$session = $this->Session;
97+
98+
$this->assertTrue($session::init(10));
99+
$this->assertFalse($session::init(10));
100+
}
88101

89102
/**
90103
* Add value to a session.

0 commit comments

Comments
 (0)