Merge branch 'view-all' into 1.3

This commit is contained in:
Mark Story 2010-02-21 22:29:22 -05:00
commit 1c7c748a7c
2 changed files with 28 additions and 1 deletions

View file

@ -189,6 +189,10 @@ class ViewTask extends Shell {
$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);
@ -196,7 +200,9 @@ class ViewTask extends Shell {
$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 @@ class ViewTask extends Shell {
$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>");

View file

@ -453,6 +453,24 @@ class ViewTaskTest extends CakeTestCase {
$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`
*