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 2121use Codeception \Util \ReflectionHelper ;
2222use Codeception \Util \Uri ;
2323use Symfony \Component \BrowserKit \Cookie ;
24+ use Symfony \Component \BrowserKit \Exception \BadMethodCallException ;
2425use Symfony \Component \DomCrawler \Crawler ;
2526use Symfony \Component \DomCrawler \Field \ChoiceFormField ;
2627use Symfony \Component \DomCrawler \Field \FileFormField ;
@@ -73,8 +74,14 @@ public function _failed(TestInterface $test, $fail)
7374 'application/xml ' => 'xml ' ,
7475 'text/plain ' => 'txt '
7576 ];
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+ }
7885
7986 $ responseContentType = $ internalResponse ? $ internalResponse ->getHeader ('content-type ' ) : '' ;
8087 list ($ responseMimeType ) = explode ('; ' , $ responseContentType );
You can’t perform that action at this time.
0 commit comments