Skip to content

Commit

Permalink
Adding output to getThemePath()
Browse files Browse the repository at this point in the history
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 1a7965f
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 1 deletion.
10 changes: 9 additions & 1 deletion cake/console/libs/tasks/template.php
Expand Up @@ -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];
}

Expand Down
1 change: 1 addition & 0 deletions cake/tests/cases/console/libs/tasks/template.test.php
Expand Up @@ -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');
}

/**
Expand Down

0 comments on commit 1a7965f

Please sign in to comment.