File tree Expand file tree Collapse file tree 1 file changed +9
-2
lines changed Expand file tree Collapse file tree 1 file changed +9
-2
lines changed Original file line number Diff line number Diff line change 21
21
use Codeception \Util \ReflectionHelper ;
22
22
use Codeception \Util \Uri ;
23
23
use Symfony \Component \BrowserKit \Cookie ;
24
+ use Symfony \Component \BrowserKit \Exception \BadMethodCallException ;
24
25
use Symfony \Component \DomCrawler \Crawler ;
25
26
use Symfony \Component \DomCrawler \Field \ChoiceFormField ;
26
27
use Symfony \Component \DomCrawler \Field \FileFormField ;
@@ -73,8 +74,14 @@ public function _failed(TestInterface $test, $fail)
73
74
'application/xml ' => 'xml ' ,
74
75
'text/plain ' => 'txt '
75
76
];
76
-
77
- $ internalResponse = $ this ->client ->getInternalResponse ();
77
+
78
+ try {
79
+ $ internalResponse = $ this ->client ->getInternalResponse ();
80
+ } 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()"
83
+ $ internalResponse = false ;
84
+ }
78
85
79
86
$ responseContentType = $ internalResponse ? $ internalResponse ->getHeader ('content-type ' ) : '' ;
80
87
list ($ responseMimeType ) = explode ('; ' , $ responseContentType );
You can’t perform that action at this time.
0 commit comments