-
-
Notifications
You must be signed in to change notification settings - Fork 9.6k
[HttpClient] Fix handling thrown \Exception in \Generator in MockResponse #44438
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
[HttpClient] Fix handling thrown \Exception in \Generator in MockResponse #44438
Conversation
fancyweb
commented
Dec 3, 2021
Q | A |
---|---|
Branch? | 4.4 |
Bug fix? | yes |
New feature? | no |
Deprecations? | no |
Tickets | - |
License | MIT |
Doc PR | - |
810e8a6
to
6ba7548
Compare
Failure is related, I need to investigate. |
@nicolas-grekas The failure is related to the PHP version. It seems that the destructor of |
3beaf09
to
f2867f4
Compare
f2867f4
to
c71265b
Compare
@@ -167,7 +210,7 @@ protected function getHttpClient(string $testCase): HttpClientInterface | |||
case 'testResolve': | |||
$responses[] = new MockResponse($body, ['response_headers' => $headers]); | |||
$responses[] = new MockResponse($body, ['response_headers' => $headers]); | |||
$responses[] = new MockResponse((function () { throw new \Exception('Fake connection timeout'); yield ''; })(), ['response_headers' => $headers]); | |||
$responses[] = new MockResponse((function () { yield ''; })(), ['response_headers' => $headers]); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
We don't need to throw for the test to be effective. Yielding after throwing "breaks" PHP 7.2.
Thank you @fancyweb. |