mirror of
https://github.com/kamilwylegala/cakephp2-php8.git
synced 2025-01-19 02:56:15 +00:00
Updating ControllerTask to use ProjectTask.
This commit is contained in:
parent
da99aa1c6a
commit
ddc341e4de
2 changed files with 10 additions and 4 deletions
|
@ -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);
|
||||
|
|
|
@ -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');
|
||||
|
|
Loading…
Add table
Reference in a new issue