Skip to content

Commit

Permalink
MDL-39489 behat: Updating to 2.6 moodlehq/behat-extension tag
Browse files Browse the repository at this point in the history
Also solving new problem after Behat
2.5 upgrade.
  • Loading branch information
David Monllao committed Oct 15, 2013
1 parent f8eff10 commit 89cf999
Show file tree
Hide file tree
Showing 3 changed files with 13 additions and 4 deletions.
2 changes: 1 addition & 1 deletion composer.json
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,6 @@
"require-dev": {
"phpunit/phpunit": "3.7.*",
"phpunit/dbUnit": "1.2.*",
"moodlehq/behat-extension": "1.25.6"
"moodlehq/behat-extension": "1.26.*"
}
}
9 changes: 6 additions & 3 deletions lib/tests/behat/behat_hooks.php
Original file line number Diff line number Diff line change
Expand Up @@ -32,6 +32,7 @@
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,
Expand Down Expand Up @@ -143,14 +144,16 @@ public function before_scenario($event) {
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);
Expand Down
6 changes: 6 additions & 0 deletions lib/tests/behat/behat_transformations.php
Original file line number Diff line number Diff line change
Expand Up @@ -56,6 +56,9 @@ class behat_transformations extends behat_base {
* @return string The string with the arguments fixed.
*/
public function arg_replace_slashes($string) {
if (!is_scalar($string)) {
return $string;
}
return str_replace('\"', '"', $string);
}

Expand All @@ -67,6 +70,9 @@ public function arg_replace_slashes($string) {
* @return string
*/
public function arg_replace_nasty_strings($argument) {
if (!is_scalar($argument)) {
return $argument;
}
return $this->replace_nasty_strings($argument);
}

Expand Down

0 comments on commit 89cf999

Please sign in to comment.