Adding a test case for DatabaseSession::gc();

This commit is contained in:
mark_story 2010-07-25 17:22:53 -04:00
parent 28b9ed7264
commit eb30c12560

View file

@ -121,4 +121,18 @@ class DatabaseSessionTest extends CakeTestCase {
$this->assertTrue(DatabaseSession::destroy('foo'), 'Destroy failed');
$this->assertFalse(DatabaseSession::read('foo'), 'Value still present.');
}
/**
* test the garbage collector
*
* @return void
*/
function testGc() {
Configure::write('Session.timeout', 0);
DatabaseSession::write('foo', 'Some value');
sleep(1);
DatabaseSession::gc();
$this->assertFalse(DatabaseSession::read('foo'));
}
}