Add new method to flush session variables

This commit is contained in:
Frederic Guillot
2015-12-06 08:23:53 -05:00
parent 9bd7985ba4
commit d0e809a32c
3 changed files with 38 additions and 1 deletions

View File

@@ -35,4 +35,26 @@ class SessionStorageTest extends Base
$storage = null;
$this->assertEquals(array('something' => array('a' => 'c'), 'd' => 'e'), $session);
}
public function testFlush()
{
$session = array('d' => 'e');
$storage = new SessionStorage();
$storage->setStorage($session);
$storage->something = array('a' => 'b');
$this->assertEquals(array('a' => 'b'), $storage->something);
$this->assertEquals('e', $storage->d);
$storage->flush();
$this->assertFalse(isset($storage->d));
$this->assertFalse(isset($storage->something));
$storage->foo = 'bar';
$storage = null;
$this->assertEquals(array('foo' => 'bar'), $session);
}
}