Skip to content

Commit

Permalink
robust test
Browse files Browse the repository at this point in the history
  • Loading branch information
spawnia committed Feb 1, 2024
1 parent 1a63bbb commit dbdf301
Showing 1 changed file with 5 additions and 4 deletions.
9 changes: 5 additions & 4 deletions tests/BavarianHolidaysTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -121,19 +121,20 @@ public static function weekend(): iterable

public function testLoadUserDefinedHolidays(): void
{
$dayOfTheTentacle = Carbon::createStrict(2019, 8, 22);
$yearOfTheTentacle = 2019;
$dayOfTheTentacle = Carbon::createStrict($yearOfTheTentacle, 8, 22);

self::assertNull(BavarianHolidays::nameHoliday($dayOfTheTentacle));
self::assertFalse(BavarianHolidays::isHoliday($dayOfTheTentacle));
self::assertTrue(BavarianHolidays::isBusinessDay($dayOfTheTentacle));

$name = 'Day of the Tentacle';
BavarianHolidays::$loadUserDefinedHolidays = static function (int $year) use ($dayOfTheTentacle, $name): array {
BavarianHolidays::$loadUserDefinedHolidays = static function (int $year) use ($yearOfTheTentacle, $dayOfTheTentacle, $name): array {
switch ($year) {
case 2019:
case $yearOfTheTentacle:
return [BavarianHolidays::dayOfTheYear($dayOfTheTentacle) => $name];
default:
self::fail('Expected the year of the passed in date to be passed');
self::fail("Expected the year of the passed in date to be passed, got {$year}.");
}
};

Expand Down

0 comments on commit dbdf301

Please sign in to comment.