Skip to content
Permalink
Browse files

Adding the ability to bake all views for one specific action. Tests a…

…dded. Fixes #251
  • Loading branch information...
markstory committed Feb 10, 2010
1 parent 6ccc43d commit d7dd63de82283f5b724cfe10d4848c323c5c6a44
Showing with 28 additions and 1 deletion.
  1. +10 −1 cake/console/libs/tasks/view.php
  2. +18 −0 cake/tests/cases/console/libs/tasks/view.test.php
@@ -189,14 +189,20 @@ function all() {
$this->Controller->interactive = false;
$tables = $this->Controller->listAll($this->connection, false);
$actions = null;
if (isset($this->args[1])) {
$actions = array($this->args[1]);
}
$this->interactive = false;
foreach ($tables as $table) {
$model = $this->_modelName($table);
$this->controllerName = $this->_controllerName($model);
$this->controllerPath = Inflector::underscore($this->controllerName);
if (App::import('Model', $model)) {
$vars = $this->__loadController();
$actions = $this->_methodsToBake();
if (!$actions) {
$actions = $this->_methodsToBake();
}
$this->bakeActions($actions, $vars);
}
}
@@ -441,6 +447,9 @@ function help() {
$this->out("\tName of the controller views to bake. Can use Plugin.name");
$this->out("\tas a shortcut for plugin baking.");
$this->out();
$this->out("<action>");
$this->out("\tName of the action view to bake");
$this->out();
$this->out('Commands:');
$this->out();
$this->out("view <controller>");
@@ -453,6 +453,24 @@ function testExecuteIntoAll() {
$this->Task->execute();
}
/**
* Test all() with action parameter
*
* @return void
* @access public
*/
function testExecuteIntoAllWithActionName() {
$this->Task->args = array('all', 'index');
$this->Task->Controller->setReturnValue('listAll', array('view_task_comments'));
$this->Task->Controller->expectOnce('listAll');
$this->Task->expectCallCount('createFile', 1);
$this->Task->expectAt(0, 'createFile', array(TMP . 'view_task_comments' . DS . 'index.ctp', '*'));
$this->Task->execute();
}
/**
* test `cake bake view $controller view`
*

0 comments on commit d7dd63d

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