-
-
Notifications
You must be signed in to change notification settings - Fork 9.6k
MockResponse total_time should not be simulated when provided #40239
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
MockResponse total_time should not be simulated when provided #40239
Conversation
Hey! Two days ago, I was sitting at my usual spot at the top of Big Ben, I was thinking that we really needed this. And now, here you are with a PR. =) I think @javespi has recently worked with this code. Maybe they can help review this? Cheers! Carsonbot |
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.
It makes sense to me 👍
if (isset($response->info['total_time'])) { | ||
if (!isset($response->info['total_time'])) { | ||
$response->info['total_time'] = microtime(true) - $response->info['start_time']; | ||
} |
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.
Just wondering why do we need this if-block twice: https://github.com/symfony/symfony/pull/40239/files#diff-7a4f5b316b06a89c94ca2309890e5c3ce140c4b97f92b1ecb6a640a8c97c259aL284-L286
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.
To measure the time that passes between the two calls.
This should target 4.4, since the bug exists there, isn't it? |
Done |
Thank you @pvgnd. |
When you provide a
total_time
to a MockResponse, it is overriden. It should be simulated only when it is not provided I guess.Ex:
new MockResponse('{"foo":"bar"}', ['total_time' => 0.4])