Skip to content

Commit

Permalink
Support lower version of Carbon
Browse files Browse the repository at this point in the history
  • Loading branch information
timacdonald committed Jul 22, 2024
1 parent 9d7c869 commit 21b7de5
Showing 1 changed file with 3 additions and 3 deletions.
6 changes: 3 additions & 3 deletions tests/Foundation/Testing/WormholeTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@

use Carbon\CarbonImmutable;
use Illuminate\Foundation\Testing\Wormhole;
use Illuminate\Support\Carbon;
use Illuminate\Support\Facades\Date;
use PHPUnit\Framework\TestCase;

Expand Down Expand Up @@ -49,15 +50,14 @@ public function testCarbonImmutableCompatibility()

public function testItCanTravelByMicroseconds()
{
Date::use(CarbonImmutable::class);
Date::setTestNow(Date::parse('2000-01-01 00:00:00')->startOfSecond());
Carbon::setTestNow(Carbon::parse('2000-01-01 00:00:00')->startOfSecond());

(new Wormhole(1))->microsecond();
$this->assertSame('2000-01-01 00:00:00.000001', Date::now()->format('Y-m-d H:i:s.u'));

(new Wormhole(5))->microseconds();
$this->assertSame('2000-01-01 00:00:00.000006', Date::now()->format('Y-m-d H:i:s.u'));

Date::useDefault();
Carbon::setTestnow();
}
}

0 comments on commit 21b7de5

Please sign in to comment.