Skip to content

Commit

Permalink
make sure all timezones are in bounds
Browse files Browse the repository at this point in the history
  • Loading branch information
Baptouuuu committed Nov 23, 2024
1 parent 670a79d commit cfb21ab
Showing 1 changed file with 14 additions and 0 deletions.
14 changes: 14 additions & 0 deletions tests/ClockTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -47,6 +47,20 @@ public function testSwitchTimezone($switch)
$this->assertIsString($clock->now()->format(Format::iso8601()));
}

#[DataProvider('zones')]
public function testTimezoneAreAlwaysInBounds($switch)
{
$offset = Clock::live()
->switch($switch)
->now()
->offset();

$this->assertGreaterThanOrEqual(-12, $offset->hours());
$this->assertLessThanOrEqual(14, $offset->hours());
$this->assertGreaterThanOrEqual(0, $offset->minutes());
$this->assertLessThanOrEqual(59, $offset->minutes());
}

public function testTimezoneDifferences()
{
$this
Expand Down

0 comments on commit cfb21ab

Please sign in to comment.