MDL-57669 behat: Exit with error code if step undefined

This commit is contained in:
Rajesh Taneja 2017-01-17 10:30:45 +08:00
parent d97582fd27
commit ada21cb0c8
No known key found for this signature in database
GPG Key ID: B363F7FB787F80E4

View File

@ -429,6 +429,11 @@ class behat_hooks extends behat_base {
public function after_step_javascript(AfterStepScope $scope) {
global $CFG, $DB;
// If step is undefined then throw exception, to get failed exit code.
if ($scope->getTestResult()->getResultCode() === Behat\Behat\Tester\Result\StepResult::UNDEFINED) {
throw new coding_exception("Step '" . $scope->getStep()->getText() . "'' is undefined.");
}
// Save the page content if the step failed.
if (!empty($CFG->behat_faildump_path) &&
$scope->getTestResult()->getResultCode() === Behat\Testwork\Tester\Result\TestResult::FAILED) {