new Session()])); $this->ComponentRegistry = new ComponentRegistry($controller); } /** * tearDown method * * @return void */ public function tearDown() { parent::tearDown(); } /** * testSessionReadWrite method * * @return void */ public function testSessionReadWrite() { $Session = new SessionComponent($this->ComponentRegistry); $this->assertNull($Session->read('Test')); $Session->write('Test', 'some value'); $this->assertEquals('some value', $Session->read('Test')); $Session->delete('Test'); $Session->write('Test.key.path', 'some value'); $this->assertEquals('some value', $Session->read('Test.key.path')); $this->assertEquals(array('path' => 'some value'), $Session->read('Test.key')); $Session->write('Test.key.path2', 'another value'); $this->assertEquals(array('path' => 'some value', 'path2' => 'another value'), $Session->read('Test.key')); $Session->delete('Test'); $array = array('key1' => 'val1', 'key2' => 'val2', 'key3' => 'val3'); $Session->write('Test', $array); $this->assertEquals($Session->read('Test'), $array); $Session->delete('Test'); $Session->write(array('Test'), 'some value'); $Session->write(array('Test' => 'some value')); $this->assertEquals('some value', $Session->read('Test')); $Session->delete('Test'); } /** * testSessionDelete method * * @return void */ public function testSessionDelete() { $Session = new SessionComponent($this->ComponentRegistry); $Session->write('Test', 'some value'); $Session->delete('Test'); $this->assertNull($Session->read('Test')); } /** * testSessionCheck method * * @return void */ public function testSessionCheck() { $Session = new SessionComponent($this->ComponentRegistry); $this->assertFalse($Session->check('Test')); $Session->write('Test', 'some value'); $this->assertTrue($Session->check('Test')); $Session->delete('Test'); } /** * testSessionId method * * @return void */ public function testSessionId() { $Session = new SessionComponent($this->ComponentRegistry); $this->assertEquals(session_id(), $Session->id()); } /** * testSessionDestroy method * * @return void */ public function testSessionDestroy() { $Session = new SessionComponent($this->ComponentRegistry); $Session->write('Test', 'some value'); $this->assertEquals('some value', $Session->read('Test')); $Session->destroy('Test'); $this->assertNull($Session->read('Test')); } }