Skip to content

Commit

Permalink
Dev: Replace exit() with assert(false) in test helper
Browse files Browse the repository at this point in the history
  • Loading branch information
olleharstedt committed Jan 17, 2018
1 parent eae53dd commit 004e4fa
Showing 1 changed file with 9 additions and 6 deletions.
15 changes: 9 additions & 6 deletions tests/TestBaseClass.php
Expand Up @@ -54,8 +54,7 @@ protected static function importSurvey($fileName)
\Yii::app()->session['loginID'] = 1;
$surveyFile = $fileName;
if (!file_exists($surveyFile)) {
echo 'Fatal error: found no survey file';
exit(1);
self::assertTrue(false, 'Found no survey file ' . $fileName);
}

$translateLinksFields = false;
Expand All @@ -70,8 +69,7 @@ protected static function importSurvey($fileName)
self::$testSurvey = \Survey::model()->findByPk($result['newsid']);
self::$surveyId = $result['newsid'];
} else {
echo 'Fatal error: Could not import survey';
exit(2);
self::assertTrue(false, 'Could not import survey file ' . $fileName);
}
}

Expand All @@ -85,8 +83,13 @@ public static function tearDownAfterClass()

if (self::$testSurvey) {
if (!self::$testSurvey->delete()) {
echo 'Fatal error: Could not clean up survey ' . self::$testSurvey->sid . '; errors: ' . json_encode(self::$testSurvey->errors);
exit(3);
self::assertTrue(
false,
'Fatal error: Could not clean up survey '
. self::$testSurvey->sid
. '; errors: '
. json_encode(self::$testSurvey->errors)
);
}
self::$testSurvey = null;
}
Expand Down

0 comments on commit 004e4fa

Please sign in to comment.