From 6176726a09164843f1c5b8c44f29292eda94ce51 Mon Sep 17 00:00:00 2001 From: BinotaLIU Date: Wed, 28 Dec 2022 00:49:40 +0800 Subject: [PATCH] Add freezeTime/freezeSecond helpers --- src/Time.php | 22 ++++++++++++++++++++++ 1 file changed, 22 insertions(+) diff --git a/src/Time.php b/src/Time.php index feffd41..3b74a08 100644 --- a/src/Time.php +++ b/src/Time.php @@ -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. *