Skip to content

Commit

Permalink
Dev: Fix group randomization test
Browse files Browse the repository at this point in the history
  • Loading branch information
olleharstedt committed Nov 6, 2017
1 parent a18f8e1 commit 4ecc182
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 13 deletions.
6 changes: 4 additions & 2 deletions tests/TestHelper.php
Original file line number Diff line number Diff line change
Expand Up @@ -201,10 +201,12 @@ public function connectToNewDatabase($databaseName)
*/
public function connectToOriginalDatabase()
{
$db = \Yii::app()->getDb();
\Yii::app()->db->setActive(false);
$config = require(\Yii::app()->getBasePath() . '/config/config.php');
\Yii::app()->setComponent('db', $config['components']['db'], false);
$db->setActive(true);
\Yii::app()->db->setActive(true);
\Yii::app()->db->schema->getTables();
\Yii::app()->db->schema->refresh();
}

/**
Expand Down
13 changes: 2 additions & 11 deletions tests/helpers/GroupRandomizationTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -22,8 +22,6 @@ class GroupRandomizationTest extends TestBaseClass
*/
public static function setupBeforeClass()
{
self::markTestSkipped();

self::$testHelper->connectToOriginalDatabase();

\Yii::app()->session['loginID'] = 1;
Expand Down Expand Up @@ -111,17 +109,10 @@ public function testRunSurvey()
$body = $this->webDriver->findElement(WebDriverBy::tagName('body'));
$text = $body->getText();

if (strpos($text, 'PHP notice') === false) {
echo 'No PHP notice';
exit(0);
} else {
echo 'PHP notice!';
exit(1);
}

// There should be no PHP notice.
//$this->assertTrue(strpos($text, 'PHP notice') === false, $text);
$this->assertTrue(strpos($text, 'PHP notice') === false, $text);

// NB: This is how to take a screenshot, if necessary.
//$screenshot = $this->webDriver->takeScreenshot();
//file_put_contents(__DIR__ . '/screenshot.png', $screenshot);

Expand Down

0 comments on commit 4ecc182

Please sign in to comment.