MockResponse total_time should not be simulated when provided#40239
MockResponse total_time should not be simulated when provided#40239nicolas-grekas merged 1 commit intosymfony:4.4from ManoManoTech:fix-mock-response-total-time
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 |
|
|
||
| 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.
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.
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_timeto 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])