mirror of
https://github.com/kamilwylegala/cakephp2-php8.git
synced 2024-11-15 03:18:26 +00:00
Fixing ComponentCollecction components loading, as with Behaviors and Helpers, thee MissingFileException can not be thrown
This commit is contained in:
parent
06fb51f19d
commit
4f01fc79c1
2 changed files with 4 additions and 4 deletions
|
@ -79,7 +79,7 @@ class ComponentCollection extends ObjectCollection {
|
|||
$alias = $component;
|
||||
$component = $settings['className'];
|
||||
}
|
||||
list($plugin, $name) = pluginSplit($component);
|
||||
list($plugin, $name) = pluginSplit($component, true);
|
||||
if (!isset($alias)) {
|
||||
$alias = $name;
|
||||
}
|
||||
|
@ -87,7 +87,7 @@ class ComponentCollection extends ObjectCollection {
|
|||
return $this->_loaded[$alias];
|
||||
}
|
||||
$componentClass = $name . 'Component';
|
||||
App::uses($componentClass, 'Controller/Component');
|
||||
App::uses($componentClass, $plugin . 'Controller/Component');
|
||||
if (!class_exists($componentClass)) {
|
||||
throw new MissingComponentClassException(array(
|
||||
'file' => Inflector::underscore($componentClass) . '.php',
|
||||
|
|
|
@ -84,7 +84,7 @@ class ComponentCollectionTest extends CakeTestCase {
|
|||
$result = $this->Components->load('Cookie');
|
||||
$this->assertInstanceOf('CookieAliasComponent', $result);
|
||||
|
||||
App::build(array('plugins' => array(TEST_CAKE_CORE_INCLUDE_PATH . 'tests' . DS . 'test_app' . DS . 'plugins' . DS)));
|
||||
App::build(array('plugins' => array(LIBS . 'tests' . DS . 'test_app' . DS . 'plugins' . DS)));
|
||||
$result = $this->Components->load('SomeOther', array('className' => 'TestPlugin.OtherComponent'));
|
||||
$this->assertInstanceOf('OtherComponentComponent', $result);
|
||||
$this->assertInstanceOf('OtherComponentComponent', $this->Components->SomeOther);
|
||||
|
@ -109,7 +109,7 @@ class ComponentCollectionTest extends CakeTestCase {
|
|||
/**
|
||||
* test missingcomponent exception
|
||||
*
|
||||
* @expectedException MissingComponentFileException
|
||||
* @expectedException MissingComponentClassException
|
||||
* @return void
|
||||
*/
|
||||
function testLoadMissingComponentFile() {
|
||||
|
|
Loading…
Reference in a new issue