Skip to content

Commit

Permalink
implement model paths
Browse files Browse the repository at this point in the history
  • Loading branch information
TonisOrmisson committed Nov 6, 2017
1 parent 5e5497a commit 55205e3
Show file tree
Hide file tree
Showing 5 changed files with 23 additions and 10 deletions.
7 changes: 7 additions & 0 deletions tests/TestBaseClass.php
Expand Up @@ -17,6 +17,11 @@ class TestBaseClass extends TestCase
/** @var string $screenshotsFolder */
protected $screenshotsFolder;

/** @var string $surveysFolder */
protected $surveysFolder;

/** @var string $dataFolder */
protected $dataFolder;

/**
* @var int
Expand All @@ -28,6 +33,8 @@ public function setUp()
parent::setUp();
self::$testHelper = new TestHelper();

$this->dataFolder = __DIR__.'/data';
$this->surveysFolder = $this->dataFolder.'/surveys';
$this->tempFolder = __DIR__.'/tmp';
$this->screenshotsFolder = $this->tempFolder.'/screenshots';

Expand Down
4 changes: 2 additions & 2 deletions tests/questions/DateTimeDefaultAnswerExpressionTest.php
Expand Up @@ -13,15 +13,15 @@ class DateTimeDefaultAnswerExpressionTest extends TestBaseClass
public function setUp()
{
parent::setUp();
$surveyFile = __DIR__ . '/../data/surveys/limesurvey_survey_454287.lss';
$surveyFile = $this->surveysFolder . '/limesurvey_survey_454287.lss';
self::importSurvey($surveyFile);
}


/**
* Destroy what had been imported.
*/
public static function teardownAfterClass()
public function tearDown()
{
$result = \Survey::model()->deleteSurvey(self::$surveyId, true);
if (!$result) {
Expand Down
8 changes: 5 additions & 3 deletions tests/questions/DateTimeForwardBackTest.php
Expand Up @@ -18,14 +18,16 @@ class DateTimeForwardBackTest extends TestBaseClass
/**
* Import survey in tests/surveys/.
*/
public static function setupBeforeClass()
public function setUp()
{
parent::setUp();

$_POST = [];
$_SESSION = [];

\Yii::app()->session['loginID'] = 1;

$surveyFile = __DIR__ . '/../data/surveys/limesurvey_survey_917744.lss';
$surveyFile = $this->surveysFolder.'/limesurvey_survey_917744.lss';
if (!file_exists($surveyFile)) {
die('Fatal error: found no survey file');
}
Expand All @@ -48,7 +50,7 @@ public static function setupBeforeClass()
/**
* Destroy what had been imported.
*/
public static function teardownAfterClass()
public function tearDown()
{
$result = \Survey::model()->deleteSurvey(self::$surveyId, true);
if (!$result) {
Expand Down
9 changes: 6 additions & 3 deletions tests/questions/DateTimeTest.php
Expand Up @@ -18,14 +18,16 @@ class DateTimeTest extends TestBaseClass
/**
* Import survey in tests/surveys/.
*/
public static function setupBeforeClass()
public function setUp()
{
parent::setUp();

$_POST = [];
$_SESSION = [];

\Yii::app()->session['loginID'] = 1;
$surveyFile = $this->surveysFolder.'/limesurvey_survey_975622.lss';

$surveyFile = __DIR__ . '/../data/surveys/limesurvey_survey_975622.lss';
if (!file_exists($surveyFile)) {
die('Fatal error: found no survey file');
}
Expand All @@ -48,8 +50,9 @@ public static function setupBeforeClass()
/**
* Destroy what had been imported.
*/
public static function teardownAfterClass()
public function tearDown()
{
parent::tearDown();
$result = \Survey::model()->deleteSurvey(self::$surveyId, true);
if (!$result) {
die('Fatal error: Could not clean up survey ' . self::$surveyId);
Expand Down
5 changes: 3 additions & 2 deletions tests/questions/DateTimeValidationTest.php
Expand Up @@ -20,11 +20,12 @@ class DateTimeValidationTest extends TestBaseClassWeb
/**
* Import survey in tests/surveys/.
*/
public static function setupBeforeClass()
public function setUp()
{
parent::setUp();
\Yii::app()->session['loginID'] = 1;

$surveyFile = __DIR__ . '/../data/surveys/limesurvey_survey_834477.lss';
$surveyFile = $this->surveysFolder.'/limesurvey_survey_834477.lss';
if (!file_exists($surveyFile)) {
die('Fatal error: found no survey file');
}
Expand Down

0 comments on commit 55205e3

Please sign in to comment.