mirror of
https://github.com/kamilwylegala/cakephp2-php8.git
synced 2024-11-15 03:18:26 +00:00
Fixing ControllerTask tests
This commit is contained in:
parent
0fe22f598a
commit
fd8a7ed6d6
2 changed files with 9 additions and 4 deletions
|
@ -107,7 +107,7 @@ class ControllerTask extends BakeTask {
|
|||
$model = $this->_modelName($table);
|
||||
$controller = $this->_controllerName($model);
|
||||
App::uses($model, 'Model');
|
||||
if (!class_exists($model)) {
|
||||
if (class_exists($model)) {
|
||||
$actions = $this->bakeActions($controller);
|
||||
if ($this->bake($controller, $actions) && $unitTestExists) {
|
||||
$this->bakeTest($controller);
|
||||
|
@ -270,9 +270,9 @@ class ControllerTask extends BakeTask {
|
|||
$currentModelName = $modelImport = $this->_modelName($controllerName);
|
||||
$plugin = $this->plugin;
|
||||
if ($plugin) {
|
||||
$modelImport = $plugin . '.' . $modelImport;
|
||||
$plugin .= '.';
|
||||
}
|
||||
App::uses($modelImport, 'Model');
|
||||
App::uses($modelImport, $plugin . 'Model');
|
||||
if (!class_exists($modelImport)) {
|
||||
$this->err(__('You must have a model for this class to build basic methods. Please try again.'));
|
||||
$this->_stop();
|
||||
|
|
|
@ -29,7 +29,12 @@ App::uses('TemplateTask', 'Console/Command/Task');
|
|||
App::uses('TestTask', 'Console/Command/Task');
|
||||
App::uses('Model', 'Model');
|
||||
|
||||
if (class_exists('BakeArticle')) {
|
||||
App::uses('BakeArticle', 'Model');
|
||||
App::uses('BakeComment', 'Model');
|
||||
App::uses('BakeTags', 'Model');
|
||||
$imported = class_exists('BakeArticle') || class_exists('BakeComment') || class_exists('BakeTag');
|
||||
|
||||
if (!$imported) {
|
||||
define('ARTICLE_MODEL_CREATED', true);
|
||||
|
||||
class BakeArticle extends Model {
|
||||
|
|
Loading…
Reference in a new issue