Skip to content

Commit

Permalink
Fixing ControllerTask tests
Browse files Browse the repository at this point in the history
  • Loading branch information
lorenzo committed Mar 8, 2011
1 parent 0fe22f5 commit fd8a7ed
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 4 deletions.
6 changes: 3 additions & 3 deletions lib/Cake/Console/Command/Task/ControllerTask.php
Expand Up @@ -107,7 +107,7 @@ public function all() {
$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);
Expand Down Expand Up @@ -270,9 +270,9 @@ public function bakeActions($controllerName, $admin = null, $wannaUseSession = t
$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();
Expand Down
Expand Up @@ -29,7 +29,12 @@
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 {
Expand Down

0 comments on commit fd8a7ed

Please sign in to comment.