Permalink
Browse files

Fixing notice errors.

  • Loading branch information...
1 parent 0a3af5b commit 3c5e4a68fb369b0e56ffb2cf7d0fe704f5df8621 @markstory markstory committed Jun 4, 2009
Showing with 23 additions and 3 deletions.
  1. +5 −3 cake/console/libs/tasks/view.php
  2. +18 −0 cake/tests/cases/console/libs/tasks/view.test.php
View
8 cake/console/libs/tasks/view.php
@@ -168,7 +168,7 @@ function all() {
if (App::import('Model', $model)) {
$vars = $this->__loadController();
if ($vars) {
- $this->bakeActions($actions);
+ $this->bakeActions($actions, $vars);
}
}
}
@@ -217,7 +217,7 @@ function __interactive() {
}
$vars = $this->__loadController();
if ($vars) {
- $this->bakeActions($actions);
+ $this->bakeActions($actions, $vars);
}
$this->hr();
$this->out('');
@@ -311,7 +311,7 @@ function __loadController() {
* @param array $actions Array of actions to make files for.
* @return void
**/
- function bakeActions($actions) {
+ function bakeActions($actions, $vars) {
foreach ($actions as $action) {
$content = $this->getContent($action, $vars);
$this->bake($action, $content);
@@ -369,6 +369,8 @@ function getContent($template = null, $vars = null) {
$vars = $this->__loadController();
}
+ $this->Template->set('action', $action);
+ $this->Template->set('plugin', $this->plugin);
$this->Template->set($vars);
$output = $this->Template->generate('views', $template);
View
18 cake/tests/cases/console/libs/tasks/view.test.php
@@ -146,5 +146,23 @@ function testBake() {
@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.