TestHelper

Extends \PHPUnit\Framework\TestCase

Methods

Import all helpers etc.

importAll() : void

getSgqa

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

Arguments

$title

string

$surveyId

int

Response

array

Get survey options for imported survey.

getSurveyOptions(int $surveyId) : array

Arguments

$surveyId

int

Response

array

activateSurvey

activateSurvey(int $surveyId) : void

Arguments

$surveyId

int

deactivateSurvey

deactivateSurvey(int $surveyId) : void

Arguments

$surveyId

int

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

updateDbFromVersion

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

Arguments

$version

int

$connection

Response

\CDbConnection

Make sure Selenium can preview surveys without being logged in.

enablePreview() : void

Drop database $databaseName.

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

Use in teardown methods.

Arguments

$databaseName

string

$connection

Use webdriver to put a screenshot in screenshot folder.

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

Arguments

$webDriver

\Facebook\WebDriver\WebDriver

$name

string

javaTrace() - provide a Java style exception trace

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

Copied from here: http://php.net/manual/en/exception.gettraceasstring.php

Arguments

$ex

$seen

mixed

  • 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

getWebDriver

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

Response

\Facebook\WebDriver\WebDriver|null