mirror of
https://github.com/silverstripe/silverstripe-framework
synced 2024-10-22 14:05:37 +02:00
96beff54fb
git-svn-id: svn://svn.silverstripe.com/silverstripe/open/modules/sapphire/trunk@112884 467b73ca-7a2a-4603-9d3b-597d59a354a9
47 lines
1.0 KiB
PHP
47 lines
1.0 KiB
PHP
<?php
|
|
|
|
/**
|
|
* Tests to cover the {@link Session} class
|
|
*
|
|
* @package sapphire
|
|
* @subpackage tests
|
|
*/
|
|
|
|
class SessionTest extends SapphireTest {
|
|
|
|
function testGetSetBasics() {
|
|
Session::set('Test', 'Test');
|
|
|
|
$this->assertEquals(Session::get('Test'), 'Test');
|
|
}
|
|
|
|
function testClearElement() {
|
|
Session::set('Test', 'Test');
|
|
Session::clear('Test');
|
|
|
|
$this->assertEquals(Session::get('Test'), '');
|
|
}
|
|
|
|
function testClearAllElements() {
|
|
Session::set('Test', 'Test');
|
|
Session::set('Test-1', 'Test-1');
|
|
|
|
Session::clear_all();
|
|
|
|
// should session get return null? The array key should probably be
|
|
// unset from the data array
|
|
$this->assertEquals(Session::get('Test'), '');
|
|
$this->assertEquals(Session::get('Test-1'), '');
|
|
}
|
|
|
|
function testGetAllElements() {
|
|
Session::clear_all(); // Remove all session that might've been set by the test harness
|
|
|
|
Session::set('Test', 'Test');
|
|
Session::set('Test-2', 'Test-2');
|
|
|
|
$session = Session::get_all();
|
|
|
|
$this->assertEquals($session, array('Test' => 'Test', 'Test-2' => 'Test-2'));
|
|
}
|
|
} |