Skip to content
Permalink
Browse files

Fixing incorrect theme paths for plugins, tests updated. Fixes #2099

  • Loading branch information...
ceeram committed Oct 13, 2011
1 parent 4090b3e commit 981f40758c7ebc18ad86c4ecb4699d7790b893b2
@@ -144,11 +144,11 @@ public function testPluginThemedGetTemplate() {
$this->Controller->theme = 'TestTheme';
$ThemeView = new TestThemeView($this->Controller);
$expected = CAKE . 'Test' . DS . 'test_app' . DS . 'View' . DS . 'Themed' . DS . 'TestTheme' . DS . 'Plugins' . DS . 'TestPlugin' . DS . 'Tests' . DS .'index.ctp';
$expected = CAKE . 'Test' . DS . 'test_app' . DS . 'View' . DS . 'Themed' . DS . 'TestTheme' . DS . 'Plugin' . DS . 'TestPlugin' . DS . 'Tests' . DS .'index.ctp';
$result = $ThemeView->getViewFileName('index');
$this->assertEqual($expected, $result);
$expected = CAKE . 'Test' . DS . 'test_app' . DS . 'View' . DS . 'Themed' . DS . 'TestTheme' . DS . 'Plugins' . DS . 'TestPlugin' . DS . 'Layouts' . DS .'plugin_default.ctp';
$expected = CAKE . 'Test' . DS . 'test_app' . DS . 'View' . DS . 'Themed' . DS . 'TestTheme' . DS . 'Plugin' . DS . 'TestPlugin' . DS . 'Layouts' . DS .'plugin_default.ctp';
$result = $ThemeView->getLayoutFileName('plugin_default');
$this->assertEqual($expected, $result);
@@ -248,7 +248,7 @@ public function testPluginPathGeneration() {
$paths = $View->paths('TestPlugin');
$pluginPath = CakePlugin::path('TestPlugin');
$expected = array(
CAKE . 'Test' . DS . 'test_app' . DS . 'View' . DS . 'Plugins' . DS . 'TestPlugin' . DS,
CAKE . 'Test' . DS . 'test_app' . DS . 'View' . DS . 'Plugin' . DS . 'TestPlugin' . DS,
$pluginPath . 'View' . DS,
$pluginPath . 'views' . DS,
$pluginPath . 'Lib' . DS . 'View' . DS,
@@ -412,7 +412,7 @@ public function testElement() {
$result = $this->View->element('plugin_element', array(), array('plugin' => 'TestPlugin'));
$this->assertEqual($result, 'this is the plugin element using params[plugin]');
$result = $this->View->element('plugin_element', array(), array('plugin' => 'test_plugin'));
$this->assertEqual($result, 'this is the plugin element using params[plugin]');
@@ -58,10 +58,10 @@ protected function _paths($plugin = null, $cached = true) {
if (!empty($this->theme)) {
$count = count($paths);
for ($i = 0; $i < $count; $i++) {
if (strpos($paths[$i], DS . 'Plugins' . DS) === false
if (strpos($paths[$i], DS . 'Plugin' . DS) === false
&& strpos($paths[$i], DS . 'Cake' . DS . 'View') === false) {
if ($plugin) {
$themePaths[] = $paths[$i] . 'Themed'. DS . $this->theme . DS . 'Plugins' . DS . $plugin . DS;
$themePaths[] = $paths[$i] . 'Themed'. DS . $this->theme . DS . 'Plugin' . DS . $plugin . DS;
}
$themePaths[] = $paths[$i] . 'Themed'. DS . $this->theme . DS;
}
@@ -753,7 +753,7 @@ protected function _paths($plugin = null, $cached = true) {
$count = count($viewPaths);
for ($i = 0; $i < $count; $i++) {
if (!isset($corePaths[$viewPaths[$i]])) {
$paths[] = $viewPaths[$i] . 'Plugins' . DS . $plugin . DS;
$paths[] = $viewPaths[$i] . 'Plugin' . DS . $plugin . DS;
}
}
$paths = array_merge($paths, App::path('View', $plugin));

0 comments on commit 981f407

Please sign in to comment.
You can’t perform that action at this time.