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.
This commit is contained in:
mark_story 2009-07-01 23:49:50 -04:00
parent 659414f04f
commit 1a7965fde0
2 changed files with 10 additions and 1 deletions

View file

@ -143,6 +143,12 @@ class TemplateTask extends Shell {
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) {
@ -150,7 +156,9 @@ class TemplateTask extends Shell {
$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];
}

View file

@ -128,6 +128,7 @@ class TemplateTaskTest extends CakeTestCase {
$this->Task->setReturnValueAt(0, 'in', '1');
$result = $this->Task->getThemePath();
$this->assertEqual($result, $defaultTheme);
$this->assertEqual($this->Dispatch->params['theme'], 'default');
}
/**