Adding tests for using a custom session config with CacheSession.

This commit is contained in:
mark_story 2010-07-25 13:37:56 -04:00
parent 49397c74af
commit 736d33647e

View file

@ -571,6 +571,37 @@ class CakeSessionTest extends CakeTestCase {
$this->assertNull(TestCakeSession::read('SessionTestCase'));
}
/**
* test that changing the config name of the cache config works.
*
* @return void
*/
function testReadAndWriteWithCustomCacheConfig() {
session_write_close();
Configure::write('Session.defaults', 'cache');
Configure::write('Session.handler.config', 'session_test');
Cache::config('session_test', array(
'engine' => 'File',
'prefix' => 'session_test_',
));
TestCakeSession::init();
TestCakeSession::destroy();
TestCakeSession::write('SessionTestCase', 'Some value');
$this->assertEquals('Some value', TestCakeSession::read('SessionTestCase'));
session_write_close();
$this->assertContains('Some value', Cache::read(TestCakeSession::id(), 'session_test'));
$this->assertFalse(Cache::read(TestCakeSession::id(), 'default'));
TestCakeSession::destroy();
Cache::delete(TestCakeSession::id(), 'session_test');
Cache::drop('session_test');
}
/**
* testReadAndWriteWithDatabaseStorage method
*