-
-
Notifications
You must be signed in to change notification settings - Fork 9.6k
[Clock] Autowire PSR interface #48347
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
Conversation
src/Symfony/Bundle/FrameworkBundle/DependencyInjection/FrameworkExtension.php
Outdated
Show resolved
Hide resolved
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.
I'm not sure about the test part, I think I'd prefer not have it but I can't argue why 😬
src/Symfony/Bundle/FrameworkBundle/DependencyInjection/FrameworkExtension.php
Show resolved
Hide resolved
Yeah, same. It doesn't feel very idiomatic Symfony to "force" something like this depending on the test mode. But on the other hand, I would like to argue that this is the only feature of the Clock component/service. Using this service implies you want to fix testability of your time-based logic and as such, I'm thinking this is sort of opt-in when deciding using the clock service? Anyway, we have to think about the practical side of the clock service and answer two questions before 6.2.0 stable (as that's our last chance to freely change behavior of this service):
If the answer of (1) is only unit tests, we can forget about this change and always use |
I tend to think we'd better only document the testing part for now. |
Thank you @wouterj. |
Sorry for doing two things in a single PR, but it felt too small to split.
ClockInterface
, just like we do for e.g. theEventDispatcherInterface
The second commit is something I want to propose after trying to write some docs on using Clock as a framework user: It isn't trivial to change the class of a definition from an application... and using a fixed moment in time while testing is the advantage of a clock component. So what about automatically switching to it when test mode is enabled?@nicolas-grekas