Permalink
Browse files

Making test bail if any of the required models exist.

  • Loading branch information...
1 parent fe2e3d8 commit 838af5862e97f773f72fabd8849429868a255be7 @markstory markstory committed May 24, 2009
Showing with 15 additions and 6 deletions.
  1. +15 −6 cake/tests/cases/console/libs/tasks/controller.test.php
@@ -51,7 +51,11 @@
array('in', 'out', 'err', 'createFile', '_stop', '_checkUnitTest')
);
-if (!class_exists('Article')) {
+$imported = App::import('Model', 'Article');
+$imported = $imported || App::import('Model', 'Comment');
+$imported = $imported || App::import('Model', 'Tag');
+
+if (!$imported) {
define('ARTICLE_MODEL_CREATED', true);
App::import('Core', 'Model');
@@ -241,7 +245,8 @@ function testBake() {
* @return void
**/
function testBakeActionsUsingSessions() {
- $skip = $this->skipIf(!defined('ARTICLE_MODEL_CREATED'), 'Testing bakeActions requires Article Model to be undefined. %s');
+ $skip = $this->skipIf(!defined('ARTICLE_MODEL_CREATED'),
+ 'Testing bakeActions requires Article, Comment & Tag Model to be undefined. %s');
if ($skip) {
return;
}
@@ -283,7 +288,8 @@ function testBakeActionsUsingSessions() {
* @return void
**/
function testBakeActionsWithNoSessions() {
- $skip = $this->skipIf(!defined('ARTICLE_MODEL_CREATED'), 'Testing bakeActions requires Article Model to be undefined. %s');
+ $skip = $this->skipIf(!defined('ARTICLE_MODEL_CREATED'),
+ 'Testing bakeActions requires Article, Tag, Comment Models to be undefined. %s');
if ($skip) {
return;
}
@@ -341,7 +347,8 @@ function testInteractive() {
* @return void
**/
function testExecuteIntoAll() {
- $skip = $this->skipIf(!defined('ARTICLE_MODEL_CREATED'), 'Execute into all could not be run as an Article model was already loaded. %s');
+ $skip = $this->skipIf(!defined('ARTICLE_MODEL_CREATED'),
+ 'Execute into all could not be run as an Article, Tag or Comment model was already loaded. %s');
if ($skip) {
return;
}
@@ -361,7 +368,8 @@ function testExecuteIntoAll() {
* @return void
**/
function testExecuteWithScaffoldParam() {
- $skip = $this->skipIf(!defined('ARTICLE_MODEL_CREATED'), 'Execute with scaffold param requires no Article model to be defined. %s');
+ $skip = $this->skipIf(!defined('ARTICLE_MODEL_CREATED'),
+ 'Execute with scaffold param requires no Article, Tag or Comment model to be defined. %s');
if ($skip) {
return;
}
@@ -383,7 +391,8 @@ function testExecuteWithScaffoldParam() {
* @return void
**/
function testExecuteWithAdminScaffoldParams() {
- $skip = $this->skipIf(!defined('ARTICLE_MODEL_CREATED'), 'Execute with scaffold admin param requires no Article model to be defined. %s');
+ $skip = $this->skipIf(!defined('ARTICLE_MODEL_CREATED'),
+ 'Execute with scaffold admin param requires no Article, Tag or Comment model to be defined. %s');
if ($skip) {
return;
}

0 comments on commit 838af58

Please sign in to comment.