Skip to content

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