Skip to content
Permalink
Browse files

Adding output to getThemePath()

Adding param setting to getThemePath() as well so template choice is saved between file generations in the same session. Test cases added.
  • Loading branch information...
markstory committed Jul 2, 2009
1 parent 659414f commit 1a7965fde04befead3c8e3cb7f520a2355084ab7
Showing with 10 additions and 1 deletion.
  1. +9 −1 cake/console/libs/tasks/template.php
  2. +1 −0 cake/tests/cases/console/libs/tasks/template.test.php
@@ -143,14 +143,22 @@ function getThemePath() {
if (!empty($this->params['theme']) && isset($this->templatePaths[$this->params['theme']])) {
return $this->templatePaths[$this->params['theme']];
}
$this->hr();
$this->out(__('You have more than one set of templates installed.', true));
$this->out(__('Please choose the template set you wish to use:', true));
$this->hr();
$i = 1;
$indexedPaths = array();
foreach ($this->templatePaths as $key => $path) {
$this->out($i . '. ' . $key);
$indexedPaths[$i] = $path;
$i++;
}
$index = $this->in(__('Which bake theme would you like to use?', true), range(1, $i), 1);
$index = $this->in(__('Which bake theme would you like to use?', true), range(1, $i - 1), 1);
$themeNames = array_keys($this->templatePaths);
$this->Dispatch->params['theme'] = $themeNames[$index - 1];
return $indexedPaths[$index];
}
@@ -128,6 +128,7 @@ function testGetThemePath() {
$this->Task->setReturnValueAt(0, 'in', '1');
$result = $this->Task->getThemePath();
$this->assertEqual($result, $defaultTheme);
$this->assertEqual($this->Dispatch->params['theme'], 'default');
}
/**

0 comments on commit 1a7965f

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