mirror of
https://github.com/moodle/moodle.git
synced 2025-08-07 09:56:38 +02:00
Merge branch 'MDL-52913_master' of git://github.com/marxjohnson/moodle
This commit is contained in:
commit
cd55c6e249
1 changed files with 10 additions and 1 deletions
|
@ -375,13 +375,22 @@ class behat_hooks extends behat_base {
|
||||||
* @AfterStep
|
* @AfterStep
|
||||||
*/
|
*/
|
||||||
public function after_step(StepEvent $event) {
|
public function after_step(StepEvent $event) {
|
||||||
global $CFG;
|
global $CFG, $DB;
|
||||||
|
|
||||||
// Save the page content if the step failed.
|
// Save the page content if the step failed.
|
||||||
if (!empty($CFG->behat_faildump_path) &&
|
if (!empty($CFG->behat_faildump_path) &&
|
||||||
$event->getResult() === StepEvent::FAILED) {
|
$event->getResult() === StepEvent::FAILED) {
|
||||||
$this->take_contentdump($event);
|
$this->take_contentdump($event);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// Abort any open transactions to prevent subsequent tests hanging.
|
||||||
|
// This does the same as abort_all_db_transactions(), but doesn't call error_log() as we don't
|
||||||
|
// want to see a message in the behat output.
|
||||||
|
if ($event->hasException()) {
|
||||||
|
if ($DB && $DB->is_transaction_started()) {
|
||||||
|
$DB->force_transaction_rollback();
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue