Skip to content

Commit af5ef76

Browse files
committed
Merge branch 'symfony5-failed'
2 parents 0b00214 + cf842c5 commit af5ef76

File tree

1 file changed

+7
-3
lines changed

1 file changed

+7
-3
lines changed

src/Codeception/Lib/InnerBrowser.php

Lines changed: 7 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -63,7 +63,13 @@ class InnerBrowser extends Module implements Web, PageSourceSaver, ElementLocato
6363

6464
public function _failed(TestInterface $test, $fail)
6565
{
66-
if (!$this->client || !$this->client->getInternalResponse()) {
66+
try {
67+
if (!$this->client || !$this->client->getInternalResponse()) {
68+
return;
69+
}
70+
} catch (BadMethodCallException $e) {
71+
//Symfony 5 throws exception if request() method threw an exception.
72+
//The "request()" method must be called before "Symfony\Component\BrowserKit\AbstractBrowser::getInternalResponse()"
6773
return;
6874
}
6975
$filename = preg_replace('~\W~', '.', Descriptor::getTestSignatureUnique($test));
@@ -78,8 +84,6 @@ public function _failed(TestInterface $test, $fail)
7884
try {
7985
$internalResponse = $this->client->getInternalResponse();
8086
} catch (BadMethodCallException $e) {
81-
//Symfony 5 throws exception if request() method threw an exception.
82-
//The "request()" method must be called before "Symfony\Component\BrowserKit\AbstractBrowser::getInternalResponse()"
8387
$internalResponse = false;
8488
}
8589

0 commit comments

Comments
 (0)