ソースを参照

Fixing ComponentCollecction components loading, as with Behaviors and Helpers, thee MissingFileException can not be thrown

José Lorenzo Rodríguez 15 年 前
コミット
4f01fc79c1

+ 2 - 2
lib/Cake/Controller/ComponentCollection.php

@@ -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',

+ 2 - 2
lib/Cake/tests/cases/libs/controller/component_collection.test.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() {