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
[Clock][RFC] pass \DateTinterval
or DateInterface
to ClockInterface::sleep()
#51850
Comments
WDYT @nicolas-grekas ? |
I'd rather keep the interface simple and have that implemented as a utility function taking the Clock and the interval/datetime. |
Also, converting an interval to seconds is ill-defined (how many seconds is |
Technically we can add this to MockClock if that can help testing, but for the interface, it'd be a BC break. |
The use case is indeed for tests purpose, in order to check life cycle of an object got example. But now I see your answer, I'm really wondering if this issue is really worth it: something like |
Thank you for this suggestion. |
I think we can close this. Thank you for the proposal though. |
Description
I think
ClockInterface::sleep()
in tests is mainly used to perform "time jumps" to predefined dates, thus it is cumbersome to always have to make the conversion to seconds in userland.I think it would be useful to be able to pass
\DateInterval
or\DateInterface
toClockInterface::sleep()
The method would become something like:
I'd be pleased to perform the PR if it seems acceptable.
Example
No response
The text was updated successfully, but these errors were encountered: