Updated session lib test to use fixtures, fixes some of the errors in the test.

git-svn-id: https://svn.cakephp.org/repo/branches/1.2.x.x@7095 3807eeeb-6ff5-0310-8944-8be069107fe0
This commit is contained in:
mark_story 2008-06-02 23:57:30 +00:00
parent f44c755475
commit 4b1335797c

View file

@ -242,29 +242,39 @@ class SessionTest extends CakeTestCase {
$this->Session->write('SessionTestCase', null);
$this->assertEqual($this->Session->read('SessionTestCase'), null);
}
/**
* testCheckUserAgentFalse method
*
* @access public
* @return void
*/
function testCheckUserAgentFalse() {
Configure::write('Session.checkAgent', false);
$this->Session->_userAgent = md5('http://randomdomainname.com' . Configure::read('Security.salt'));
$this->assertTrue($this->Session->valid());
}
/**
* testCheckUserAgentTrue method
*
* @access public
* @return void
*/
function testCheckUserAgentTrue() {
Configure::write('Session.checkAgent', true);
$this->Session->_userAgent = md5('http://randomdomainname.com' . Configure::read('Security.salt'));
$this->assertFalse($this->Session->valid());
}
/**
* testReadAndWriteWithDatabaseStorage method
*
* @access public
* @return void
*/
function testReadAndWriteWithDatabaseStorage() {
$this->tearDown();
$this->loadFixtures('Session');
unset($_SESSION);
Configure::write('Session.table', 'sessions');
Configure::write('Session.database', 'default');
Configure::write('Session.save', 'database');
$this->setUp();
$this->Session->renew();
$this->Session->write('SessionTestCase', 0);
$this->assertEqual($this->Session->read('SessionTestCase'), 0);