diff --git a/cake/libs/view/view.php b/cake/libs/view/view.php index d0ad82bdf..80b29d21c 100644 --- a/cake/libs/view/view.php +++ b/cake/libs/view/view.php @@ -800,7 +800,7 @@ class View extends Object { } } - $paths = $this->_paths($this->plugin); + $paths = $this->_paths(Inflector::underscore($this->plugin)); foreach ($paths as $path) { if (file_exists($path . $name . $this->ext)) { @@ -840,7 +840,7 @@ class View extends Object { if (!is_null($this->layoutPath)) { $subDir = $this->layoutPath . DS; } - $paths = $this->_paths($this->plugin); + $paths = $this->_paths(Inflector::underscore($this->plugin)); $file = 'layouts' . DS . $subDir . $name; $exts = array($this->ext, '.ctp', '.thtml'); diff --git a/cake/tests/cases/libs/view/view.test.php b/cake/tests/cases/libs/view/view.test.php index a3bc87803..50dbc4260 100644 --- a/cake/tests/cases/libs/view/view.test.php +++ b/cake/tests/cases/libs/view/view.test.php @@ -248,6 +248,29 @@ class ViewTest extends CakeTestCase { $this->assertEqual($result, $expected); } /** + * test that CamelCase plugins still find their view files. + * + * @return void + **/ + function testCamelCasePluginGetTemplate() { + $this->Controller->plugin = 'TestPlugin'; + $this->Controller->name = 'TestPlugin'; + $this->Controller->viewPath = 'tests'; + $this->Controller->action = 'index'; + + $View = new TestView($this->Controller); + Configure::write('pluginPaths', array(TEST_CAKE_CORE_INCLUDE_PATH . 'tests' . DS . 'test_app' . DS . 'plugins' . DS)); + Configure::write('viewPaths', array(TEST_CAKE_CORE_INCLUDE_PATH . 'tests' . DS . 'test_app' . DS . 'views'. DS)); + + $expected = TEST_CAKE_CORE_INCLUDE_PATH . 'tests' . DS . 'test_app' . DS . 'plugins' . DS .'test_plugin' . DS . 'views' . DS .'tests' . DS .'index.ctp'; + $result = $View->getViewFileName('index'); + $this->assertEqual($result, $expected); + + $expected = TEST_CAKE_CORE_INCLUDE_PATH . 'tests' . DS . 'test_app' . DS . 'plugins' . DS .'test_plugin' . DS . 'views' . DS . 'layouts' . DS .'default.ctp'; + $result = $View->getLayoutFileName(); + $this->assertEqual($result, $expected); + } +/** * testGetTemplate method * * @access public