Skip to content

Commit

Permalink
Merge branch 'view-all' into 1.3
Browse files Browse the repository at this point in the history
  • Loading branch information
markstory committed Feb 22, 2010
2 parents 8615274 + d7dd63d commit 1c7c748
Show file tree
Hide file tree
Showing 2 changed files with 28 additions and 1 deletion.
11 changes: 10 additions & 1 deletion cake/console/libs/tasks/view.php
Expand Up @@ -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);
}
}
Expand Down Expand Up @@ -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>");
Expand Down
18 changes: 18 additions & 0 deletions cake/tests/cases/console/libs/tasks/view.test.php
Expand Up @@ -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`
*
Expand Down

0 comments on commit 1c7c748

Please sign in to comment.