From 781c3438c2af00a74a3c40f1ff782c0516b24cbe Mon Sep 17 00:00:00 2001 From: Andrew Nicols Date: Tue, 15 Feb 2022 14:56:59 +0800 Subject: [PATCH] MDL-73883 behat: Display actual step during testing Because of the way in which we check for exceptions, we always show the following string during behat pretty output: behat_hooks::i_look_for_exceptions() We can easily modify this to only show this value when the i_look_for_exceptions() test itself fails, but otherwise to show the actual step that is run. --- .../EventDispatcher/Tester/ChainedStepTester.php | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/lib/behat/extension/Moodle/BehatExtension/EventDispatcher/Tester/ChainedStepTester.php b/lib/behat/extension/Moodle/BehatExtension/EventDispatcher/Tester/ChainedStepTester.php index e480e001dda..a1b150258f5 100644 --- a/lib/behat/extension/Moodle/BehatExtension/EventDispatcher/Tester/ChainedStepTester.php +++ b/lib/behat/extension/Moodle/BehatExtension/EventDispatcher/Tester/ChainedStepTester.php @@ -125,7 +125,13 @@ class ChainedStepTester implements StepTester { // Extra step, looking for a moodle exception, a debugging() message or a PHP debug message. $checkingStep = new StepNode('Given', self::EXCEPTIONS_STEP_TEXT, array(), $step->getLine()); $afterExceptionCheckingEvent = $this->singlesteptester->test($env, $feature, $checkingStep, $skip); - return $this->checkSkipResult($afterExceptionCheckingEvent); + $exceptionCheckResult = $this->checkSkipResult($afterExceptionCheckingEvent); + + if (!$exceptionCheckResult->isPassed()) { + return $exceptionCheckResult; + } + + return $result; } return $this->runChainedSteps($env, $feature, $result, $skip);