diff --git a/tests/Cmixin/BusinessDayTest.php b/tests/Cmixin/BusinessDayTest.php index 817c114..016ff6d 100644 --- a/tests/Cmixin/BusinessDayTest.php +++ b/tests/Cmixin/BusinessDayTest.php @@ -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;