Skip to content

Commit

Permalink
Merge pull request #32 from binotaliu/feature/time-freeze-helpers
Browse files Browse the repository at this point in the history
Add `freezeTime`/`freezeSecond` helpers
  • Loading branch information
nunomaduro committed Dec 27, 2022
2 parents e3c013a + 6176726 commit d6b8590
Showing 1 changed file with 22 additions and 0 deletions.
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

0 comments on commit d6b8590

Please sign in to comment.