mirror of
https://github.com/kamilwylegala/cakephp2-php8.git
synced 2025-01-19 02:56:15 +00:00
Adding support + test cases for plugin and app/libs session handlers.
This commit is contained in:
parent
5673ceb816
commit
db5c44e386
2 changed files with 48 additions and 2 deletions
|
@ -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);
|
||||
}
|
||||
|
|
|
@ -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
|
||||
*
|
||||
|
|
Loading…
Add table
Reference in a new issue