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

[9.x] Fix time mocking in CacheRepositoryTest #41824

Merged
merged 3 commits into from
Apr 4, 2022

Conversation

kylekatarnls
Copy link
Contributor

setTestNow() should not be done in dataProvider. dataProvider in general shouldn't modify any state as they are triggered by PHPUnit in early steps and not related to the tests done with this provider.

For this case (CacheRepositoryTest) the time should be always mocked, else stuff like $repo->getStore()->shouldReceive('put')->once()->with('foo', 'bar', 602) can't be guaranteed because few microseconds elapsed since Carbon::now()->addMinutes(10)->addSeconds(2) was called.

Relates to #41810, #40790

@kylekatarnls kylekatarnls marked this pull request as draft April 4, 2022 13:36
@kylekatarnls kylekatarnls marked this pull request as ready for review April 4, 2022 13:39
@taylorotwell taylorotwell merged commit 0f3c06b into laravel:9.x Apr 4, 2022
@kylekatarnls kylekatarnls deleted the patch-11 branch April 4, 2022 15:12
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

Successfully merging this pull request may close these issues.

2 participants