TestHelper

Extends \PHPUnit\Framework\TestCase

package

Default

Methods

activateSurvey

activateSurvey(integer $surveyId) : void

Arguments

$surveyId

integer

Overwrite the db component with a new configuration and database.

connectToNewDatabase(string $databaseName) : boolean

Before you run this, you might want to save the old db config in a variable, so you can reconnect to it after you're done with the new database. $config = require(\Yii::app()->getBasePath() . '/config/config.php');

Arguments

$databaseName

string

Response

boolean

| \CDbConnection

connectToOriginalDatabase

connectToOriginalDatabase() : void

deactivateSurvey

deactivateSurvey(integer $surveyId) : void

Arguments

$surveyId

integer

Make sure Selenium can preview surveys without being logged in.

enablePreview() : void

getSgqa

getSgqa(string $title, integer $surveyId) : array

Arguments

$title

string

$surveyId

integer

Response

array

Get survey options for imported survey.

getSurveyOptions(integer $surveyId) : array

Arguments

$surveyId

integer

Response

array

getWebDriver

getWebDriver() : \Facebook\WebDriver\WebDriver|null

Response

\Facebook\WebDriver\WebDriver|null

Import all helpers etc.

importAll() : void

javaTrace() - provide a Java style exception trace

javaTrace( $ex,  $seen = null) : array

Arguments

$ex

$seen

  • array passed to recursive calls to accumulate trace lines already seen leave as NULL when calling this function

Response

array

of strings, one entry per trace line

Use webdriver to put a screenshot in screenshot folder.

takeScreenshot(\Facebook\WebDriver\WebDriver $webDriver, string $name) : void

Arguments

$webDriver

\Facebook\WebDriver\WebDriver

$name

string

Drop database $databaseName.

teardownDatabase(string $databaseName,  $connection = null) : void

Use in teardown methods.

Arguments

$databaseName

string

$connection

updateDbFromVersion

updateDbFromVersion(integer $version,  $connection = null) : \CDbConnection

Arguments

$version

integer

$connection

Response

\CDbConnection