From d0e809a32cd58c0d89b2425aeb245e04a94df7d6 Mon Sep 17 00:00:00 2001 From: Frederic Guillot Date: Sun, 6 Dec 2015 08:23:53 -0500 Subject: Add new method to flush session variables --- tests/units/Core/Session/SessionStorageTest.php | 22 ++++++++++++++++++++++ 1 file changed, 22 insertions(+) (limited to 'tests/units/Core') diff --git a/tests/units/Core/Session/SessionStorageTest.php b/tests/units/Core/Session/SessionStorageTest.php index 62495e5e..dd0040d5 100644 --- a/tests/units/Core/Session/SessionStorageTest.php +++ b/tests/units/Core/Session/SessionStorageTest.php @@ -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); + } } -- cgit v1.2.3