diff --git a/lib/Cake/Core/App.php b/lib/Cake/Core/App.php index 64449f97ea3..5ac30048423 100644 --- a/lib/Cake/Core/App.php +++ b/lib/Cake/Core/App.php @@ -614,10 +614,10 @@ public static function import($type = null, $name = null, $parent = true, $searc return true; } - $originalType = $type = strtolower($type); - $specialPackage = in_array($type, array('file', 'vendor')); - if (!$specialPackage && isset(self::$legacy[$type . 's'])) { - $type = self::$legacy[$type . 's']; + $originalType = strtolower($type); + $specialPackage = in_array($originalType, array('file', 'vendor')); + if (!$specialPackage && isset(self::$legacy[$originalType . 's'])) { + $type = self::$legacy[$originalType . 's']; } list($plugin, $name) = pluginSplit($name); if (!empty($plugin)) { @@ -628,11 +628,11 @@ public static function import($type = null, $name = null, $parent = true, $searc return self::_loadClass($name, $plugin, $type, $originalType, $parent); } - if ($type == 'file' && !empty($file)) { + if ($originalType == 'file' && !empty($file)) { return self::_loadFile($name, $plugin, $search, $file, $return); } - if ($type == 'vendor') { + if ($originalType == 'vendor') { return self::_loadVendor($name, $plugin, $file, $ext); } diff --git a/lib/Cake/tests/Case/Core/AppTest.php b/lib/Cake/tests/Case/Core/AppTest.php index fe3b53aea55..10a5b90c1d2 100644 --- a/lib/Cake/tests/Case/Core/AppTest.php +++ b/lib/Cake/tests/Case/Core/AppTest.php @@ -285,9 +285,11 @@ function testListObjectsInPlugin() { $this->assertTrue(in_array('TestPluginPersisterOne', $result)); $result = App::objects('TestPlugin.helper'); + sort($result); $expected = array('OtherHelperHelper', 'PluggedHelper', 'TestPluginApp'); $this->assertEquals($result, $expected); $result = App::objects('TestPlugin.View/Helper'); + sort($result); $expected = array('OtherHelperHelper', 'PluggedHelper', 'TestPluginApp'); $this->assertEquals($result, $expected); @@ -462,7 +464,7 @@ function testPluginImporting() { $result = App::import('Helper', 'TestPlugin.OtherHelper'); $this->assertTrue($result); $this->assertTrue(class_exists('OtherHelperHelper')); - + $result = App::import('Helper', 'TestPlugin.TestPluginApp'); $this->assertTrue($result); $this->assertTrue(class_exists('TestPluginAppHelper')); @@ -470,7 +472,7 @@ function testPluginImporting() { $result = App::import('Datasource', 'TestPlugin.TestSource'); $this->assertTrue($result); $this->assertTrue(class_exists('TestSource')); - + App::build(); }