Additional test coverage for SessionHelper

git-svn-id: https://svn.cakephp.org/repo/branches/1.2.x.x@6778 3807eeeb-6ff5-0310-8944-8be069107fe0
This commit is contained in:
nate 2008-05-09 16:13:30 +00:00
parent a53d308fa3
commit a5822e6967

View file

@ -45,27 +45,27 @@ class SessionHelperTest extends CakeTestCase {
$this->Session = new SessionHelper();
$this->Session->__start();
$_SESSION = array('test' => 'info',
'Message' => array(
'flash' => array(
'layout' => 'default',
'params' => array(),
'message' => 'This is a calling'
),
'notification' => array(
'layout' => 'sessionHelper',
'params' => array('title' => 'Notice!',
'name' => 'Alert!'),
'message' => 'This is a test of the emergency broadcasting system',
),
'bare' => array(
'layout' => null,
'message' => 'Bare message',
'params' => array(),
),
),
'Deeply' => array('nested' => array('key' => 'value')),
);
$_SESSION = array(
'test' => 'info',
'Message' => array(
'flash' => array(
'layout' => 'default',
'params' => array(),
'message' => 'This is a calling'
),
'notification' => array(
'layout' => 'sessionHelper',
'params' => array('title' => 'Notice!', 'name' => 'Alert!'),
'message' => 'This is a test of the emergency broadcasting system',
),
'bare' => array(
'layout' => null,
'message' => 'Bare message',
'params' => array(),
),
),
'Deeply' => array('nested' => array('key' => 'value')),
);
}
function tearDown() {
@ -79,7 +79,6 @@ class SessionHelperTest extends CakeTestCase {
$result = $this->Session->read('test');
$this->assertEqual($result, 'info');
}
function testCheck() {
@ -146,6 +145,22 @@ class SessionHelperTest extends CakeTestCase {
$this->assertEqual($result, $expected);
}
function testDisabling() {
Configure::write('Session.start', false);
$this->Session = new SessionHelper();
$this->assertFalse($this->Session->check('test'));
$this->assertFalse($this->Session->read('test'));
$this->Session->read('CauseError');
$this->assertFalse($this->Session->error());
ob_start();
$this->assertFalse($this->Session->flash('bare'));
$result = ob_get_contents();
ob_clean();
$this->assertFalse($result);
}
function testValid() {
//wierd it always ends up false in the test suite
//$this->assertFalse($this->Session->valid());