From 3e5a0a70fe1541cf76ec0c0e631ba66ef2c82f0d Mon Sep 17 00:00:00 2001 From: Jason Varga Date: Fri, 31 May 2024 10:07:13 -0400 Subject: [PATCH] use explicit dates --- tests/Modifiers/RelativeTest.php | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/tests/Modifiers/RelativeTest.php b/tests/Modifiers/RelativeTest.php index 124bd406a3..1b6dc4fd4d 100644 --- a/tests/Modifiers/RelativeTest.php +++ b/tests/Modifiers/RelativeTest.php @@ -11,7 +11,9 @@ class RelativeTest extends TestCase /** @test */ public function it_converts_a_date_to_relative() { - $date = new Carbon('today -1 month'); + Carbon::setTestNow('2024-06-30'); + + $date = new Carbon('2024-05-30'); $this->assertEquals('1 month ago', $this->modify($date)); } @@ -19,7 +21,9 @@ public function it_converts_a_date_to_relative() /** @test */ public function it_converts_a_date_to_relative_without_modifiers() { - $date = new Carbon('today -1 month'); + Carbon::setTestNow('2024-06-30'); + + $date = new Carbon('2024-05-30'); $this->assertEquals('1 month', $this->modify($date, true)); $this->assertEquals('1 month', $this->modify($date, 'true'));