diff --git a/cake/console/libs/tasks/controller.php b/cake/console/libs/tasks/controller.php index c6895b8b4..1b499ff26 100644 --- a/cake/console/libs/tasks/controller.php +++ b/cake/console/libs/tasks/controller.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 @@ class ControllerTask extends Shell { $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); diff --git a/cake/tests/cases/console/libs/tasks/controller.test.php b/cake/tests/cases/console/libs/tasks/controller.test.php index 1a9dd68b0..897043e05 100644 --- a/cake/tests/cases/console/libs/tasks/controller.test.php +++ b/cake/tests/cases/console/libs/tasks/controller.test.php @@ -31,12 +31,12 @@ if (!class_exists('ShellDispatcher')) { 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 @@ Mock::generatePartial( 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 @@ class ControllerTaskTest extends CakeTestCase { $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 @@ class ControllerTaskTest extends CakeTestCase { 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');