Adding support + test cases for plugin and app/libs session handlers.

This commit is contained in:
mark_story 2010-07-25 19:09:29 -04:00
parent 5673ceb816
commit db5c44e386
2 changed files with 48 additions and 2 deletions

View file

@ -581,8 +581,8 @@ class CakeSession {
* @return void
*/
protected static function _getHandler($handler) {
$class = $handler;
$found = App::import('Lib', 'session/' . $class);
list($plugin, $class) = pluginSplit($handler, true);
$found = App::import('Lib', $plugin . 'session/' . $class);
if (!$found) {
App::import('Core', 'session/' . $class);
}

View file

@ -536,6 +536,52 @@ class CakeSessionTest extends CakeTestCase {
$this->assertNull(TestCakeSession::read('SessionTestCase'));
}
/**
* test using a handler from app/libs.
*
* @return void
*/
function testUsingAppLibsHandler() {
App::build(array(
'libs' => array(TEST_CAKE_CORE_INCLUDE_PATH . 'tests' . DS . 'test_app' . DS . 'libs' . DS),
'plugins' => array(TEST_CAKE_CORE_INCLUDE_PATH . 'tests' . DS . 'test_app' . DS . 'plugins' . DS)
), true);
Configure::write('Session', array(
'defaults' => 'cake',
'handler' => array(
'engine' => 'TestAppLibSession'
)
));
TestCakeSession::destroy();
$this->assertTrue(TestCakeSession::started());
App::build();
}
/**
* test using a handler from a plugin.
*
* @return void
*/
function testUsingPluginHandler() {
App::build(array(
'libs' => array(TEST_CAKE_CORE_INCLUDE_PATH . 'tests' . DS . 'test_app' . DS . 'libs' . DS),
'plugins' => array(TEST_CAKE_CORE_INCLUDE_PATH . 'tests' . DS . 'test_app' . DS . 'plugins' . DS)
), true);
Configure::write('Session', array(
'defaults' => 'cake',
'handler' => array(
'engine' => 'TestPlugin.TestPluginSession'
)
));
TestCakeSession::destroy();
$this->assertTrue(TestCakeSession::started());
App::build();
}
/**
* testReadAndWriteWithDatabaseStorage method
*