Skip to content

Commit 04c4680

Browse files
committed
Fix internal exception in codeception
1 parent c5dff0b commit 04c4680

File tree

1 file changed

+6
-9
lines changed

1 file changed

+6
-9
lines changed

src/Magento/FunctionalTestingFramework/Extension/TestContextExtension.php

+6-9
Original file line numberDiff line numberDiff line change
@@ -267,15 +267,12 @@ public function attachExceptionToAllure($exception, $testMethod)
267267

268268
AllureHelper::addAttachmentToCurrentStep($exception, $context . 'Exception');
269269

270-
//pop suppressed exceptions and attach to allure
271-
$change = function () {
272-
if ($this instanceof \PHPUnit\Framework\ExceptionWrapper) {
273-
return $this->previous;
274-
} else {
275-
return $this->getPrevious();
276-
}
277-
};
278-
$previousException = $change->call($exception);
270+
$previousException = null;
271+
if ($exception instanceof \PHPUnit\Framework\ExceptionWrapper) {
272+
$previousException = $exception->getPreviousWrapped();
273+
} elseif ($exception instanceof \Throwable) {
274+
$previousException = $exception->getPrevious();
275+
}
279276

280277
if ($previousException !== null) {
281278
$this->attachExceptionToAllure($previousException, $testMethod);

0 commit comments

Comments
 (0)