"require-dev": {
"phpunit/phpunit": "3.7.*",
"phpunit/dbUnit": "1.2.*",
- "moodlehq/behat-extension": "1.25.6"
+ "moodlehq/behat-extension": "1.26.*"
}
}
use Behat\Behat\Event\SuiteEvent as SuiteEvent,
Behat\Behat\Event\ScenarioEvent as ScenarioEvent,
Behat\Behat\Event\StepEvent as StepEvent,
+ Behat\Mink\Exception\DriverException as DriverException,
WebDriver\Exception\NoSuchWindow as NoSuchWindow,
WebDriver\Exception\UnexpectedAlertOpen as UnexpectedAlertOpen,
WebDriver\Exception\UnknownError as UnknownError,
throw new coding_exception('Behat only can modify the test database and the test dataroot!');
}
+ $moreinfo = 'More info in ' . behat_command::DOCS_URL . '#Running_tests';
+ $driverexceptionmsg = 'Selenium server is not running, you need to start it to run tests that involve Javascript. ' . $moreinfo;
try {
$session = $this->getSession();
} catch (CurlExec $e) {
// Exception thrown by WebDriver, so only @javascript tests will be caugth; in
// behat_util::is_server_running() we already checked that the server is running.
- $moreinfo = 'More info in ' . behat_command::DOCS_URL . '#Running_tests';
- $msg = 'Selenium server is not running, you need to start it to run tests that involve Javascript. ' . $moreinfo;
- throw new Exception($msg);
+ throw new Exception($driverexceptionmsg);
+ } catch (DriverException $e) {
+ throw new Exception($driverexceptionmsg);
} catch (UnknownError $e) {
// Generic 'I have no idea' Selenium error. Custom exception to provide more feedback about possible solutions.
$this->throw_unknown_exception($e);
* @return string The string with the arguments fixed.
*/
public function arg_replace_slashes($string) {
+ if (!is_scalar($string)) {
+ return $string;
+ }
return str_replace('\"', '"', $string);
}
* @return string
*/
public function arg_replace_nasty_strings($argument) {
+ if (!is_scalar($argument)) {
+ return $argument;
+ }
return $this->replace_nasty_strings($argument);
}