Skip to content

Commit

Permalink
Add unit test
Browse files Browse the repository at this point in the history
  • Loading branch information
kylekatarnls committed Oct 18, 2024
1 parent 8a5d381 commit 7417615
Showing 1 changed file with 16 additions and 0 deletions.
16 changes: 16 additions & 0 deletions tests/Cmixin/BusinessDayTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -216,6 +216,22 @@ public function testMultipleIfRule()
self::assertFalse($carbon::parse('2025-06-23')->isHoliday());
}

public function testIfRuleWithHijriCalendar()
{
$carbon = static::CARBON_CLASS;
$carbon::resetHolidays();
$carbon::setHolidays('custom', [
'hari-raya-puasa' => '= 1 Shawwal if sunday then next monday',
]);
$carbon::setHolidaysRegion('custom');
$year = static function (int $year) use ($carbon) {
return array_map('strval', $carbon::getYearHolidays($year));
};

self::assertSame(['hari-raya-puasa' => '2020-05-25 00:00:00'], $year(2020));
self::assertSame(['hari-raya-puasa' => '2021-05-13 00:00:00'], $year(2021));
}

public function testCaseInsensitivity()
{
$carbon = static::CARBON_CLASS;
Expand Down

0 comments on commit 7417615

Please sign in to comment.