diff --git a/course/tests/behat/behat_course.php b/course/tests/behat/behat_course.php index d06a8bf6c0d..76c9c7755c5 100644 --- a/course/tests/behat/behat_course.php +++ b/course/tests/behat/behat_course.php @@ -1360,7 +1360,8 @@ class behat_course extends behat_base { try { return $DB->get_field('course_categories', 'id', array('idnumber' => $idnumber), MUST_EXIST); } catch (dml_missing_record_exception $ex) { - throw new ExpectationException(sprintf("There is no category in the database with the idnumber '%s'", $idnumber)); + throw new ExpectationException(sprintf("There is no category in the database with the idnumber '%s'", $idnumber), + $this->getSession()); } } @@ -1378,7 +1379,8 @@ class behat_course extends behat_base { try { return $DB->get_field('course', 'id', array('idnumber' => $idnumber), MUST_EXIST); } catch (dml_missing_record_exception $ex) { - throw new ExpectationException(sprintf("There is no course in the database with the idnumber '%s'", $idnumber)); + throw new ExpectationException(sprintf("There is no course in the database with the idnumber '%s'", $idnumber), + $this->getSession()); } } diff --git a/lib/tests/behat/behat_general.php b/lib/tests/behat/behat_general.php index 36075385a0d..07a47bd31b6 100644 --- a/lib/tests/behat/behat_general.php +++ b/lib/tests/behat/behat_general.php @@ -1575,7 +1575,7 @@ EOF; if ($content !== $expectedcontent) { throw new ExpectationException('Image is not identical to the fixture. Received ' . - strlen($content) . ' bytes and expected ' . strlen($expectedcontent) . ' bytes'); + strlen($content) . ' bytes and expected ' . strlen($expectedcontent) . ' bytes', $this->getSession()); } } @@ -1860,7 +1860,8 @@ EOF; list($modifier, $char) = preg_split('/-/', $key, 2); $modifier = strtolower($modifier); if (!in_array($modifier, $validmodifiers)) { - throw new ExpectationException(sprintf('Unknown key modifier: %s.', $modifier)); + throw new ExpectationException(sprintf('Unknown key modifier: %s.', $modifier), + $this->getSession()); } } if (is_numeric($char)) { diff --git a/mod/quiz/tests/behat/behat_mod_quiz.php b/mod/quiz/tests/behat/behat_mod_quiz.php index 417b26d370a..d637ae8fe5d 100644 --- a/mod/quiz/tests/behat/behat_mod_quiz.php +++ b/mod/quiz/tests/behat/behat_mod_quiz.php @@ -417,7 +417,8 @@ class behat_mod_quiz extends behat_question_base { } else if (preg_match('~Page (\d+)~', $pageorlast, $matches)) { $xpath = "//li[@id = 'page-{$matches[1]}']//a[contains(@data-toggle, 'dropdown') and contains(., 'Add')]"; } else { - throw new ExpectationException("The I open the add to quiz menu step must specify either 'Page N' or 'last'."); + throw new ExpectationException("The I open the add to quiz menu step must specify either 'Page N' or 'last'.", + $this->getSession()); } $this->find('xpath', $xpath)->click(); }