diff options
author | Frederic Guillot <fred@kanboard.net> | 2015-11-15 12:50:33 -0500 |
---|---|---|
committer | Frederic Guillot <fred@kanboard.net> | 2015-11-15 12:50:33 -0500 |
commit | a675271ad71b7713d1b33bdba3c51b2b04813229 (patch) | |
tree | e54d8a95e16ca521193b9fd5a5eb071aa2910823 /tests/units/Core/Session/SessionStorageTest.php | |
parent | 2fc402f6733573627ad25394d109b9f848ef04f6 (diff) |
Rewrite of session management
Diffstat (limited to 'tests/units/Core/Session/SessionStorageTest.php')
-rw-r--r-- | tests/units/Core/Session/SessionStorageTest.php | 38 |
1 files changed, 38 insertions, 0 deletions
diff --git a/tests/units/Core/Session/SessionStorageTest.php b/tests/units/Core/Session/SessionStorageTest.php new file mode 100644 index 00000000..62495e5e --- /dev/null +++ b/tests/units/Core/Session/SessionStorageTest.php @@ -0,0 +1,38 @@ +<?php + +require_once __DIR__.'/../../Base.php'; + +use Kanboard\Core\Session\SessionStorage; + +class SessionStorageTest extends Base +{ + public function testNotPersistentStorage() + { + $storage = new SessionStorage(); + $storage->something = array('a' => 'b'); + $this->assertEquals(array('a' => 'b'), $storage->something); + $this->assertTrue(isset($storage->something)); + $this->assertFalse(isset($storage->something->x)); + $this->assertFalse(isset($storage->notFound)); + $this->assertFalse(isset($storage->notFound->x)); + $this->assertFalse(isset($storage->notFound['x'])); + } + + public function testPersistentStorage() + { + $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->something['a'] = 'c'; + $this->assertEquals('c', $storage->something['a']); + + $storage = null; + $this->assertEquals(array('something' => array('a' => 'c'), 'd' => 'e'), $session); + } +} |