Skip to content
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

Can timecop be used to override the native functions for all requests? #28

Open
WillGibson opened this issue Sep 26, 2017 · 1 comment

Comments

@WillGibson
Copy link

We have some Behat scenarios which revolve around what happens just before and just after midday.

So we need to specify the time in a step, then make a request to a URL to see what happens.

I thought timecop might cover this, but it seems to only affect the process where you call timecop_freeze().

Am I missing something, or do I need to look for another approach.

@IonBazan
Copy link
Contributor

IonBazan commented Nov 8, 2017

You should save the specified time in filesystem or other storage. Then load this time in the second request and freeze the time using timecop.
Better solution would be to use a time provider to mock the time in a more elegant way.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants