Skip to content

Commit

Permalink
Fixing ComponentCollecction components loading, as with Behaviors and…
Browse files Browse the repository at this point in the history
… Helpers, thee MissingFileException can not be thrown
  • Loading branch information
lorenzo committed Jan 28, 2011
1 parent 06fb51f commit 4f01fc7
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 4 deletions.
4 changes: 2 additions & 2 deletions lib/Cake/Controller/ComponentCollection.php
Expand Up @@ -79,15 +79,15 @@ public function load($component, $settings = array()) {
$alias = $component;
$component = $settings['className'];
}
list($plugin, $name) = pluginSplit($component);
list($plugin, $name) = pluginSplit($component, true);
if (!isset($alias)) {
$alias = $name;
}
if (isset($this->_loaded[$alias])) {
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',
Expand Down
Expand Up @@ -84,7 +84,7 @@ function testLoadWithAlias() {
$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);
Expand All @@ -109,7 +109,7 @@ function testLoadWithEnableFalse() {
/**
* test missingcomponent exception
*
* @expectedException MissingComponentFileException
* @expectedException MissingComponentClassException
* @return void
*/
function testLoadMissingComponentFile() {
Expand Down

0 comments on commit 4f01fc7

Please sign in to comment.