Skip to content

Commit

Permalink
Adding tests for using a custom session config with CacheSession.
Browse files Browse the repository at this point in the history
  • Loading branch information
markstory committed Jul 28, 2010
1 parent 49397c7 commit 736d336
Showing 1 changed file with 31 additions and 0 deletions.
31 changes: 31 additions & 0 deletions cake/tests/cases/libs/cake_session.test.php
Expand Up @@ -571,6 +571,37 @@ function testReadAndWriteWithCacheStorage() {
$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
*
Expand Down

0 comments on commit 736d336

Please sign in to comment.