Skip to content

Commit

Permalink
Add unit test
Browse files Browse the repository at this point in the history
  • Loading branch information
kylekatarnls committed Sep 21, 2021
1 parent b3d4100 commit 7f6eddf
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 @@ -212,6 +212,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 7f6eddf

Please sign in to comment.