mirror of
https://github.com/kamilwylegala/cakephp2-php8.git
synced 2025-01-31 09:06:17 +00:00
Fixing loading of default options in CakePlugin::loadAll(), fixes #1737
This commit is contained in:
parent
a025cb2e01
commit
8a6d97dfa7
2 changed files with 8 additions and 4 deletions
|
@ -97,8 +97,11 @@ class CakePlugin {
|
|||
public function loadAll($options = array()) {
|
||||
$plugins = App::objects('plugins');
|
||||
foreach ($plugins as $p) {
|
||||
$opts = isset($options[$p]) ? $options[$p] : $options;
|
||||
self::load($p, $opts);
|
||||
$opts = isset($options[$p]) ? $options[$p] : null;
|
||||
if ($opts === null && isset($options[0])) {
|
||||
$opts = $options[0];
|
||||
}
|
||||
self::load($p, (array) $opts);
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -216,7 +216,8 @@ class CakePluginTest extends CakeTestCase {
|
|||
* @return void
|
||||
*/
|
||||
public function testLoadAllWithDefaults() {
|
||||
CakePlugin::loadAll(array('bootstrap' => true));
|
||||
$defaults = array('bootstrap' => true);
|
||||
CakePlugin::loadAll(array($defaults));
|
||||
$expected = array('PluginJs', 'TestPlugin', 'TestPluginTwo');
|
||||
$this->assertEquals($expected, CakePlugin::loaded());
|
||||
$this->assertEquals('loaded js plugin bootstrap', Configure::read('CakePluginTest.js_plugin.bootstrap'));
|
||||
|
@ -231,7 +232,7 @@ class CakePluginTest extends CakeTestCase {
|
|||
* @return void
|
||||
*/
|
||||
public function testLoadAllWithDefaultsAndOverride() {
|
||||
CakePlugin::loadAll(array('bootstrap' => true, 'TestPlugin' => array('routes' => true)));
|
||||
CakePlugin::loadAll(array(array('bootstrap' => true), 'TestPlugin' => array('routes' => true)));
|
||||
CakePlugin::routes();
|
||||
|
||||
$expected = array('PluginJs', 'TestPlugin', 'TestPluginTwo');
|
||||
|
|
Loading…
Add table
Reference in a new issue