mirror of
https://github.com/kamilwylegala/cakephp2-php8.git
synced 2024-11-15 11:28:25 +00:00
Adding some destroy() calls to cause the timestamps to refresh.
This commit is contained in:
parent
ca1c8f1f80
commit
0c312e3d77
1 changed files with 13 additions and 8 deletions
|
@ -349,32 +349,37 @@ class SessionComponentTest extends CakeTestCase {
|
|||
* @return void
|
||||
*/
|
||||
function testSessionTimeout() {
|
||||
Configure::write('debug', 2);
|
||||
Configure::write('Security.level', 'low');
|
||||
$Session =& new SessionComponent();
|
||||
$Session->write('Test', 'some value');
|
||||
|
||||
$this->assertEqual($Session->sessionTime, mktime() + (300 * Configure::read('Session.timeout')));
|
||||
session_destroy();
|
||||
$Session =& new SessionComponent();
|
||||
$Session->destroy();
|
||||
$Session->write('Test', 'some value');
|
||||
$this->assertEqual($Session->sessionTime, time() + (300 * Configure::read('Session.timeout')));
|
||||
$this->assertEqual($_SESSION['Config']['timeout'], 10);
|
||||
$this->assertEqual($_SESSION['Config']['time'], $Session->sessionTime);
|
||||
$this->assertEqual($Session->time, mktime());
|
||||
$this->assertEqual($_SESSION['Config']['time'], $Session->time + (Security::inactiveMins() * Configure::read('Session.timeout')));
|
||||
$this->assertEqual($Session->time, time());
|
||||
$this->assertEqual($_SESSION['Config']['time'], $Session->time + (300 * Configure::read('Session.timeout')));
|
||||
|
||||
Configure::write('Security.level', 'medium');
|
||||
$Session =& new SessionComponent();
|
||||
$Session->destroy();
|
||||
$Session->write('Test', 'some value');
|
||||
$this->assertEqual($Session->sessionTime, mktime() + (100 * Configure::read('Session.timeout')));
|
||||
$this->assertEqual($_SESSION['Config']['timeout'], 10);
|
||||
$this->assertEqual($_SESSION['Config']['time'], $Session->sessionTime);
|
||||
$this->assertEqual($Session->time, mktime());
|
||||
$this->assertEqual($Session->time, time());
|
||||
$this->assertEqual($_SESSION['Config']['time'], $Session->time + (Security::inactiveMins() * Configure::read('Session.timeout')));
|
||||
|
||||
Configure::write('Security.level', 'high');
|
||||
$Session =& new SessionComponent();
|
||||
$Session->destroy();
|
||||
$Session->write('Test', 'some value');
|
||||
$this->assertEqual($Session->sessionTime, mktime() + (10 * Configure::read('Session.timeout')));
|
||||
$this->assertEqual($Session->sessionTime, time() + (10 * Configure::read('Session.timeout')));
|
||||
$this->assertEqual($_SESSION['Config']['timeout'], 10);
|
||||
$this->assertEqual($_SESSION['Config']['time'], $Session->sessionTime);
|
||||
$this->assertEqual($Session->time, mktime());
|
||||
$this->assertEqual($Session->time, time());
|
||||
$this->assertEqual($_SESSION['Config']['time'], $Session->time + (Security::inactiveMins() * Configure::read('Session.timeout')));
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue