Fixing ControllerTask tests

This commit is contained in:
Jose Lorenzo Rodriguez 2011-03-08 01:25:01 -04:30
parent 0fe22f598a
commit fd8a7ed6d6
2 changed files with 9 additions and 4 deletions

View file

@ -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();

View file

@ -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 {