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

Add freezeTime/freezeSecond helpers #32

Merged
merged 1 commit into from
Dec 27, 2022
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
22 changes: 22 additions & 0 deletions src/Time.php
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,28 @@

use DateTimeInterface;

/**
* Freeze time.
*
* @param callable|null $callback
* @return mixed
*/
function freezeTime($callback = null)
{
return test()->freezeTime($callback);
}

/**
* Freeze time at the beginning of the current second.
*
* @param callable|null $callback
* @return mixed
*/
function freezeSecond($callback = null)
{
return test()->freezeSecond($callback);
}

/**
* Begin travelling to another time.
*
Expand Down