Skip to content

Commit

Permalink
Fixing notice errors.
Browse files Browse the repository at this point in the history
  • Loading branch information
markstory committed Jun 4, 2009
1 parent 0a3af5b commit 3c5e4a6
Show file tree
Hide file tree
Showing 2 changed files with 23 additions and 3 deletions.
8 changes: 5 additions & 3 deletions cake/console/libs/tasks/view.php
Expand Up @@ -168,7 +168,7 @@ function all() {
if (App::import('Model', $model)) { if (App::import('Model', $model)) {
$vars = $this->__loadController(); $vars = $this->__loadController();
if ($vars) { if ($vars) {
$this->bakeActions($actions); $this->bakeActions($actions, $vars);
} }
} }
} }
Expand Down Expand Up @@ -217,7 +217,7 @@ function __interactive() {
} }
$vars = $this->__loadController(); $vars = $this->__loadController();
if ($vars) { if ($vars) {
$this->bakeActions($actions); $this->bakeActions($actions, $vars);
} }
$this->hr(); $this->hr();
$this->out(''); $this->out('');
Expand Down Expand Up @@ -311,7 +311,7 @@ function __loadController() {
* @param array $actions Array of actions to make files for. * @param array $actions Array of actions to make files for.
* @return void * @return void
**/ **/
function bakeActions($actions) { function bakeActions($actions, $vars) {
foreach ($actions as $action) { foreach ($actions as $action) {
$content = $this->getContent($action, $vars); $content = $this->getContent($action, $vars);
$this->bake($action, $content); $this->bake($action, $content);
Expand Down Expand Up @@ -369,6 +369,8 @@ function getContent($template = null, $vars = null) {
$vars = $this->__loadController(); $vars = $this->__loadController();
} }


$this->Template->set('action', $action);
$this->Template->set('plugin', $this->plugin);
$this->Template->set($vars); $this->Template->set($vars);
$output = $this->Template->generate('views', $template); $output = $this->Template->generate('views', $template);


Expand Down
18 changes: 18 additions & 0 deletions cake/tests/cases/console/libs/tasks/view.test.php
Expand Up @@ -146,5 +146,23 @@ function testBake() {


@rmdir(TMP . 'view_task_comments'); @rmdir(TMP . 'view_task_comments');
} }

/**
* test bake actions baking multiple actions.
*
* @return void
**/
function testBakeActions() {
$this->Task->path = TMP;
$this->Task->controllerName = 'ViewTaskComments';
$this->Task->controllerPath = 'view_task_comments';

$this->Task->expectAt(0, 'createFile', array(TMP . 'view_task_comments' . DS . 'view.ctp', '*'));
$this->Task->expectAt(1, 'createFile', array(TMP . 'view_task_comments' . DS . 'edit.ctp', '*'));
$this->Task->expectAt(2, 'createFile', array(TMP . 'view_task_comments' . DS . 'index.ctp', '*'));

$this->Task->bakeActions(array('view', 'edit', 'index'), array());
@rmdir(TMP . 'view_task_comments');
}
} }
?> ?>

0 comments on commit 3c5e4a6

Please sign in to comment.