Skip to content
Permalink
Browse files

Updating ControllerTask to use ProjectTask.

  • Loading branch information...
markstory committed Jul 1, 2009
1 parent da99aa1 commit ddc341e4de518e817496d1a7dfd8e4b28ae87f15
Showing with 10 additions and 4 deletions.
  1. +2 −2 cake/console/libs/tasks/controller.php
  2. +8 −2 cake/tests/cases/console/libs/tasks/controller.test.php
@@ -44,7 +44,7 @@ class ControllerTask extends Shell {
* @var array
* @access public
*/
var $tasks = array('Model', 'Test', 'Template', 'DbConfig');
var $tasks = array('Model', 'Test', 'Template', 'DbConfig', 'Project');
/**
* path to CONTROLLERS directory
*
@@ -86,7 +86,7 @@ function execute() {
$actions = 'scaffold';
}
if ((isset($this->args[1]) && $this->args[1] == 'admin') || (isset($this->args[2]) && $this->args[2] == 'admin')) {
if ($admin = $this->getAdmin()) {
if ($admin = $this->Project->getAdmin()) {
$this->out('Adding ' . Configure::read('Routing.admin') .' methods');
if ($actions == 'scaffold') {
$actions = $this->bakeActions($controller, $admin);
@@ -31,12 +31,12 @@
ob_end_clean();
}
require_once CAKE . 'console' . DS . 'libs' . DS . 'tasks' . DS . 'project.php';
require_once CAKE . 'console' . DS . 'libs' . DS . 'tasks' . DS . 'controller.php';
require_once CAKE . 'console' . DS . 'libs' . DS . 'tasks' . DS . 'model.php';
require_once CAKE . 'console' . DS . 'libs' . DS . 'tasks' . DS . 'template.php';
require_once CAKE . 'console' . DS . 'libs' . DS . 'tasks' . DS . 'test.php';
Mock::generatePartial(
'ShellDispatcher', 'TestControllerTaskMockShellDispatcher',
array('getInput', 'stdout', 'stderr', '_stop', '_initEnvironment')
@@ -52,6 +52,11 @@
array('in', 'out', 'err', 'createFile', '_stop', '_checkUnitTest')
);
Mock::generatePartial(
'ProjectTask', 'ControllerMockProjectTask',
array('in', 'out', 'err', 'createFile', '_stop', '_checkUnitTest', 'getAdmin')
);
Mock::generate('TestTask', 'ControllerMockTestTask');
$imported = App::import('Model', 'Article');
@@ -97,6 +102,7 @@ function startTest() {
$this->Task->Dispatch->shellPaths = Configure::read('shellPaths');
$this->Task->Template =& new TemplateTask($this->Task->Dispatch);
$this->Task->Model =& new ControllerMockModelTask($this->Task->Dispatch);
$this->Task->Project =& new ControllerMockProjectTask($this->Task->Dispatch);
}
/**
@@ -449,7 +455,7 @@ function testExecuteWithAdminScaffoldParams() {
if ($skip) {
return;
}
Configure::write('Routing.admin', 'admin');
$this->Task->Project->setReturnValue('getAdmin', 'admin_');
$this->Task->connection = 'test_suite';
$this->Task->path = '/my/path/';
$this->Task->args = array('Articles', 'scaffold', 'admin');

0 comments on commit ddc341e

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