From 36c1f18d0c2e65de0b206c02e308aa35de8a0f63 Mon Sep 17 00:00:00 2001 From: Lairg Date: Tue, 30 Mar 2021 15:46:30 +0200 Subject: [PATCH] Added months() to Wormhole (#36808) --- src/Illuminate/Foundation/Testing/Wormhole.php | 13 +++++++++++++ 1 file changed, 13 insertions(+) diff --git a/src/Illuminate/Foundation/Testing/Wormhole.php b/src/Illuminate/Foundation/Testing/Wormhole.php index d660fe026a75..6258f6de2e11 100644 --- a/src/Illuminate/Foundation/Testing/Wormhole.php +++ b/src/Illuminate/Foundation/Testing/Wormhole.php @@ -102,6 +102,19 @@ public function weeks($callback = null) return $this->handleCallback($callback); } + /** + * Travel forward the given number of months. + * + * @param callable|null $callback + * @return mixed + */ + public function months($callback = null) + { + Carbon::setTestNow(Carbon::now()->addMonths($this->value)); + + return $this->handleCallback($callback); + } + /** * Travel forward the given number of years. *