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

[5.3] Use Carbon instead of time() #15544

Merged
merged 1 commit into from
Sep 21, 2016
Merged

[5.3] Use Carbon instead of time() #15544

merged 1 commit into from
Sep 21, 2016

Conversation

themsaid
Copy link
Member

As mentioned in this issue: #14253

Carbon library has a very useful and easy to use feature to travel in time inside tests:

$knownDate = Carbon::create(2001, 5, 21, 12);
Carbon::setTestNow($knownDate);    

Since Carbon is a current dependency in laravel, this PR replaces all calls to php's built in time() function and uses Carbon instead, allowing tests to "Time Travel".

@@ -77,7 +78,7 @@ public function get($key)
$cache = (object) $cache;
}

if (time() >= $cache->expiration) {
if (Carbon::now()->timestamp >= $cache->expiration) {
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

why not use getTime() function here?

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.

None yet

3 participants