Skip to content

Commit

Permalink
Add missing isEqualToInTimezone
Browse files Browse the repository at this point in the history
  • Loading branch information
Christian Kolb committed Jun 9, 2024
1 parent 2d9f776 commit 9c8306a
Showing 1 changed file with 21 additions and 2 deletions.
23 changes: 21 additions & 2 deletions tests/Moment/IsEqualToInTimeZoneTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@
use DigitalCraftsman\DateTimePrecision\Moment;
use DigitalCraftsman\DateTimePrecision\Month;
use DigitalCraftsman\DateTimePrecision\Time;
use DigitalCraftsman\DateTimePrecision\Weekday;
use DigitalCraftsman\DateTimePrecision\Year;
use PHPUnit\Framework\TestCase;

Expand All @@ -24,7 +25,7 @@ final class IsEqualToInTimeZoneTest extends TestCase
public function is_equal_to_in_time_zone_works(
bool $expectedResult,
Moment $moment,
Time | Date | Month | Year $comparator,
Time | Weekday | Date | Month | Year $comparator,
\DateTimeZone $timeZone,
): void {
// -- Act & Assert
Expand All @@ -35,7 +36,7 @@ public function is_equal_to_in_time_zone_works(
* @return array<string, array{
* 0: boolean,
* 1: Moment,
* 2: Time | Date | Month | Year,
* 2: Time | Weekday | Date | Month | Year,
* 3: \DateTimeZone,
* }>
*/
Expand All @@ -60,6 +61,24 @@ public static function dataProvider(): array
Time::fromString('15:00:00'),
new \DateTimeZone('Europe/Berlin'),
],
'moment before weekday' => [
false,
Moment::fromStringInTimeZone('2022-10-07 15:00:00', new \DateTimeZone('Europe/Berlin')),
Weekday::SATURDAY,
new \DateTimeZone('Europe/Berlin'),
],
'moment same weekday' => [
true,
Moment::fromStringInTimeZone('2022-10-08 15:00:00', new \DateTimeZone('Europe/Berlin')),
Weekday::SATURDAY,
new \DateTimeZone('Europe/Berlin'),
],
'moment after weekday' => [
false,
Moment::fromStringInTimeZone('2022-10-09 15:00:00', new \DateTimeZone('Europe/Berlin')),
Weekday::SATURDAY,
new \DateTimeZone('Europe/Berlin'),
],
'moment before date' => [
false,
Moment::fromStringInTimeZone('2022-10-07 15:00:00', new \DateTimeZone('Europe/Berlin')),
Expand Down

0 comments on commit 9c8306a

Please sign in to comment.