Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP
Browse files

Merge pull request #623 from dereuromark/2.2-bake-theme-order

Correct order of bake themes so app and plugin precede core ones

Fixes #2825
  • Loading branch information...
commit f150ebb9ccc080786a58faf5123748066bd2830a 2 parents 474eb89 + acd06d6
@markstory markstory authored
View
17 lib/Cake/Console/Command/Task/TemplateTask.php
@@ -55,11 +55,18 @@ public function initialize() {
* Find the paths to all the installed shell themes in the app.
*
* Bake themes are directories not named `skel` inside a `Console/Templates` path.
- *
+ * They are listed in this order: app -> plugin -> default
+ *
* @return array Array of bake themes that are installed.
*/
protected function _findThemes() {
- $paths = array();
+ $paths = App::path('Console');
+
+ $plugins = App::objects('plugin');
+ foreach ($plugins as $plugin) {
+ $paths[] = $this->_pluginPath($plugin) . 'Console' . DS;
+ }
+
$core = current(App::core('Console'));
$separator = DS === '/' ? '/' : '\\\\';
$core = preg_replace('#shells' . $separator . '$#', '', $core);
@@ -69,13 +76,7 @@ protected function _findThemes() {
$contents = $Folder->read();
$themeFolders = $contents[0];
- $plugins = App::objects('plugin');
$paths[] = $core;
- foreach ($plugins as $plugin) {
- $paths[] = $this->_pluginPath($plugin) . 'Console' . DS;
- }
-
- $paths = array_merge($paths, App::path('Console'));
// TEMPORARY TODO remove when all paths are DS terminated
foreach ($paths as $i => $path) {
View
8 lib/Cake/Test/Case/Console/Command/Task/TemplateTaskTest.php
@@ -107,15 +107,15 @@ public function testGetThemePath() {
$result = $this->Task->getThemePath();
$this->assertEquals($defaultTheme, $result);
- $this->Task->templatePaths = array('default' => $defaultTheme, 'other' => '/some/path');
+ $this->Task->templatePaths = array('other' => '/some/path', 'default' => $defaultTheme);
$this->Task->params['theme'] = 'other';
$result = $this->Task->getThemePath();
$this->assertEquals('/some/path', $result);
$this->Task->params = array();
$result = $this->Task->getThemePath();
- $this->assertEquals($defaultTheme, $result);
- $this->assertEquals('default', $this->Task->params['theme']);
+ $this->assertEquals('/some/path', $result);
+ $this->assertEquals('other', $this->Task->params['theme']);
}
/**
@@ -134,7 +134,7 @@ public function testGenerate() {
$result = $this->Task->generate('classes', 'test_object', array('test' => 'foo'));
$expected = "I got rendered\nfoo";
- $this->assertEquals($expected, $result);
+ $this->assertTextEquals($expected, $result);
}
/**
Please sign in to comment.
Something went wrong with that request. Please try again.