diff --git a/lang/syria/ar/holidays.json b/lang/syria/ar/holidays.json index 0d8232130..10fad8a7f 100644 --- a/lang/syria/ar/holidays.json +++ b/lang/syria/ar/holidays.json @@ -1,16 +1,20 @@ { - "New Year\n's Day": "يوم رأس السنة", - "Mother\n's Day": "عيد الأم", - "Teacher\n's Day": "عيد المعلم", - "Western Easter": "عيد الفصح الغربي", - "Eid al-Fitr": "عيد الفطر السعيد", - "Syrian Independence Day": "عيد الجلاء واستقلال سورية", + "New Year's Day": "رأس السنة الميلادية", + "Mother's Day": "عيد الأم", + "Independence Day": "عيد الاستقلال", "Labor Day": "عيد العمال", + "Martyrs' Day": "عيد الشهداء", + "Anniversary of the October War": "ذكرى حرب تشرين التحريرية", + "Christmas": "عيد الميلاد المجيد", + "Western Easter": "عيد الفصح الغربي", "Eastern Easter": "عيد الفصح الشرقي", - "Martyrs\n' Day": "عيد الشهداء", - "Eid al-Adha": "عيد الأضحى المبارك", - "Islamic New Year": "عيد رأس السنة الهجرية", - "The commemoration of the birth of the Prophet Muhammad": "عيد مولد الرسول الأعظم", - "The October Liberation War": "ذكرى حرب تشرين التحريرية", - "Merry Christmas": "عيد الميلاد المجيد" + "Eid al-Fitr Eve": "ليلة عيد الفطر", + "Eid al-Fitr 1. Day": "عيد الفطر اليوم الأول", + "Eid al-Fitr 2. Day": "عيد الفطر اليوم الثاني", + "Eid al-Fitr 3. Day": "عيد الفطر اليوم الثالث", + "Eid al-Adha Eve": "ليلة عيد الأضحى", + "Eid al-Adha 1. Day": "عيد الأضحى اليوم الأول", + "Eid al-Adha 2. Day": "عيد الأضحى اليوم الثاني", + "Eid al-Adha 3. Day": "عيد الأضحى اليوم الثالث", + "Eid al-Adha 4. Day": "عيد الأضحى اليوم الرابع" } diff --git a/src/Countries/Syria.php b/src/Countries/Syria.php index 86ecd5d38..66ad0c8e8 100644 --- a/src/Countries/Syria.php +++ b/src/Countries/Syria.php @@ -3,9 +3,176 @@ namespace Spatie\Holidays\Countries; use Carbon\CarbonImmutable; +use RuntimeException; class Syria extends Country { + /* + * > No library or built-in php intl functions convert dates properly for all years or all country including “geniusts/hijri-dates”. + * + * > It is most logical to prepare the dates between 1970 and 2037 as a constant property for Islamic holidays, Because Islamic holidays predicted and actual dates may change until the last moment. + * + * > Since the information on wikipedia is incorrect, it was obtained by searching the old calendar on Google Images for each year. + * + * > The accuracy of the information has been double-checked. + * + * > A converter algorithm that will cover all years does not seem possible. + */ + + public const alFitrHolidays = [ + 1970 => '12-01', + 1971 => '11-20', + 1972 => '11-08', + 1973 => '10-28', + 1974 => '10-17', + 1975 => '10-06', + 1976 => '09-25', + 1977 => '09-15', + 1978 => '09-04', + 1979 => '08-24', + 1980 => '08-12', + 1981 => '08-01', + 1982 => '07-22', + 1983 => '07-12', + 1984 => '06-30', + 1985 => '06-20', + 1986 => '06-09', + 1987 => '05-29', + 1988 => '05-17', + 1989 => '05-06', + 1990 => '04-26', + 1991 => '04-16', + 1992 => '04-04', + 1993 => '03-24', + 1994 => '03-13', + 1995 => '03-03', + 1996 => '02-20', + 1997 => '02-09', + 1998 => '01-29', + 1999 => '01-19', + 2000 => [ + '01-08', + '12-27', + ], + 2001 => '12-16', + 2002 => '12-05', + 2003 => '11-25', + 2004 => '11-14', + 2005 => '11-03', + 2006 => '10-23', + 2007 => '10-12', + 2008 => '09-30', + 2009 => '09-20', + 2010 => '09-09', + 2011 => '08-30', + 2012 => '08-19', + 2013 => '08-08', + 2014 => '07-28', + 2015 => '07-17', + 2016 => '07-05', + 2017 => '06-25', + 2018 => '06-15', + 2019 => '06-04', + 2020 => '05-24', + 2021 => '05-13', + 2022 => '05-02', + 2023 => '04-21', + 2024 => '04-10', + 2025 => '04-30', + 2026 => '03-20', + 2027 => '03-09', + 2028 => '02-26', + 2029 => '02-14', + 2030 => '02-03', + 2031 => '01-24', + 2032 => '01-14', + 2033 => [ + '01-02', + '12-23', + ], + 2034 => '12-11', + 2035 => '12-01', + 2036 => '11-19', + 2037 => '11-09', + ]; + + public const alAdhaHolidays = [ + 1970 => '02-17', + 1971 => '02-16', + 1972 => '01-27', + 1973 => '01-15', + 1974 => [ + '01-04', + '12-24', + ], + 1975 => '12-13', + 1976 => '12-02', + 1977 => '11-22', + 1978 => '11-11', + 1979 => '10-31', + 1980 => '10-19', + 1981 => '10-08', + 1982 => '09-27', + 1983 => '09-17', + 1984 => '09-06', + 1985 => '08-26', + 1986 => '08-16', + 1987 => '08-05', + 1988 => '07-24', + 1989 => '07-13', + 1990 => '07-03', + 1991 => '06-23', + 1992 => '06-11', + 1993 => '06-01', + 1994 => '05-21', + 1995 => '05-10', + 1996 => '04-28', + 1997 => '04-18', + 1998 => '04-07', + 1999 => '03-28', + 2000 => '03-16', + 2001 => '03-05', + 2002 => '02-22', + 2003 => '02-11', + 2004 => '02-01', + 2005 => '01-20', + 2006 => [ + '01-10', + '12-31', + ], + 2007 => '12-20', + 2008 => '12-08', + 2009 => '11-27', + 2010 => '11-16', + 2011 => '11-06', + 2012 => '10-25', + 2013 => '10-15', + 2014 => '10-04', + 2015 => '09-23', + 2016 => '09-12', + 2017 => '09-01', + 2018 => '08-21', + 2019 => '08-11', + 2020 => '07-31', + 2021 => '07-20', + 2022 => '07-09', + 2023 => '06-28', + 2024 => '06-16', + 2025 => '06-06', + 2026 => '05-26', + 2027 => '05-16', + 2028 => '05-04', + 2029 => '04-23', + 2030 => '04-13', + 2031 => '04-02', + 2032 => '03-21', + 2033 => '03-11', + 2034 => '02-28', + 2035 => '02-17', + 2036 => '02-07', + 2037 => '01-26', + ]; + public function countryCode(): string { return 'sy'; @@ -14,27 +181,121 @@ public function countryCode(): string protected function allHolidays(int $year): array { return array_merge([ - "New Year\n's Day" => '01-01', - "Mother\n's Day" => '03-21', - "Teacher\n's Day" => '03-21', - 'Western Easter' => '03-31', - 'Eid al-Fitr' => '04-10', - 'Syrian Independence Day' => '04-17', + 'New Year\'s Day' => '01-01', + 'Mother\'s Day' => '03-21', + 'Independence Day' => '04-17', 'Labor Day' => '05-01', - 'Eastern Easter' => '05-05', - "Martyr\n's Day" => '05-06', - 'Eid al-Adha' => '06-16', - 'Islamic New Year' => '07-07', - 'The commemoration of the birth of the Prophet Muhammad' => '09-15', - 'The October Liberation War' => '10-06', + 'Martyrs\' Day' => '05-06', + 'Anniversary of the October War' => '10-06', 'Christmas' => '12-25', + ], $this->variableHolidays($year)); } - /** @return array */ + /** @return array */ protected function variableHolidays(int $year): array { - // The variable holidays all follow the lunar calendar, so their dates are not confirmed. - return []; + $easter = $this->easter($year); + $gregorianCalendarHolidays = []; + + $gregorianCalendarHolidays['Western Easter'] = $easter; + $gregorianCalendarHolidays['Eastern Easter'] = $easter->addDays(35); + + return array_merge( + $gregorianCalendarHolidays, $this->getIslamicHolidays( + year: $year, + holidays: self::alFitrHolidays, + label: 'Eid al-Fitr', + day: 3 + ), $this->getIslamicHolidays( + year: $year, + holidays: self::alAdhaHolidays, + label: 'Eid al-Adha', + day: 4 + )); + } + + /** + * @param array> $holidays + * @return array + */ + protected function getIslamicHolidays( + int $year, + array $holidays, + string $label, + int $day, + ): array { + $islamicHolidays = []; + $counter = 0; + + if ($year != 1970) { + $previousHoliday = is_array($holidays[$year - 1]) ? $holidays[$year - 1][1] : $holidays[$year - 1]; + + $previousHoliday = CarbonImmutable::createFromFormat('Y-m-d', ($year - 1).'-'.$previousHoliday) + ?: throw new RuntimeException('Date could not be created.'); + + if ($previousHoliday->addDays($day - 1)->year == $year) { + $islamicHolidays = $this->prepareHolidays( + holiday: $previousHoliday, + day: $day, + label: $label, + filterYear: $year + ); + $counter++; + } + } + + $currentYearHolidays = is_array($holidays[$year]) ? $holidays[$year] : [$holidays[$year]]; + + foreach ($currentYearHolidays as $currentYearHoliday) { + $currentYearHoliday = CarbonImmutable::createFromFormat('Y-m-d', "{$year}-{$currentYearHoliday}") + ?: throw new RuntimeException('Date could not be created.'); + + $islamicHolidays = array_merge($islamicHolidays, $this->prepareHolidays( + holiday: $currentYearHoliday, + day: $day, + label: $label, + filterYear: $year, + prefix: $counter ? ($counter + 1).'. ' : '' + )); + $counter++; + } + + if ($year != 2037) { + $nextHoliday = is_array($holidays[$year + 1]) ? $holidays[$year + 1][1] : $holidays[$year + 1]; + + $nextHoliday = CarbonImmutable::createFromFormat('Y-m-d', ($year + 1).'-'.$nextHoliday) + ?: throw new RuntimeException('Date could not be created.'); + + if ($nextHoliday->addDays(-1)->year == $year) { + $islamicHolidays = array_merge($islamicHolidays, $this->prepareHolidays( + holiday: $nextHoliday, + day: $day, + label: $label, + filterYear: $year, + prefix: $counter ? ($counter + 1).'. ' : '' + )); + } + } + + return $islamicHolidays; + } + + /** @return array */ + protected function prepareHolidays( + CarbonImmutable $holiday, + int $day, + string $label, + int $filterYear, + string $prefix = '' + ): array { + $holidays = []; + + $holidays[$prefix.$label.' Eve'] = $holiday->addDays(-1); + foreach (range(1, $day) as $range) { + $holidays[$prefix.$label.' '.$range.'. Day'] = $holiday->addDays($range - 1); + } + + return array_filter($holidays, fn ($holiday) => $holiday->year == $filterYear); } } diff --git a/tests/.pest/snapshots/Countries/SyriaTest/it_can_calculate_syria_holidays.snap b/tests/.pest/snapshots/Countries/SyriaTest/it_can_calculate_syria_holidays.snap deleted file mode 100644 index 4216d3aef..000000000 --- a/tests/.pest/snapshots/Countries/SyriaTest/it_can_calculate_syria_holidays.snap +++ /dev/null @@ -1,58 +0,0 @@ -[ - { - "name": "New Year\n's Day", - "date": "2024-01-01" - }, - { - "name": "Mother\n's Day", - "date": "2024-03-21" - }, - { - "name": "Teacher\n's Day", - "date": "2024-03-21" - }, - { - "name": "Western Easter", - "date": "2024-03-31" - }, - { - "name": "Eid al-Fitr", - "date": "2024-04-10" - }, - { - "name": "Syrian Independence Day", - "date": "2024-04-17" - }, - { - "name": "Labor Day", - "date": "2024-05-01" - }, - { - "name": "Eastern Easter", - "date": "2024-05-05" - }, - { - "name": "Martyr\n's Day", - "date": "2024-05-06" - }, - { - "name": "Eid al-Adha", - "date": "2024-06-16" - }, - { - "name": "Islamic New Year", - "date": "2024-07-07" - }, - { - "name": "The commemoration of the birth of the Prophet Muhammad", - "date": "2024-09-15" - }, - { - "name": "The October Liberation War", - "date": "2024-10-06" - }, - { - "name": "Christmas", - "date": "2024-12-25" - } -] \ No newline at end of file diff --git a/tests/.pest/snapshots/Countries/SyriaTest/it_can_calculate_syrian_holidays_with_data_set___1970____1970_.snap b/tests/.pest/snapshots/Countries/SyriaTest/it_can_calculate_syrian_holidays_with_data_set___1970____1970_.snap new file mode 100644 index 000000000..28ccfa76f --- /dev/null +++ b/tests/.pest/snapshots/Countries/SyriaTest/it_can_calculate_syrian_holidays_with_data_set___1970____1970_.snap @@ -0,0 +1,74 @@ +[ + { + "name": "New Year's Day", + "date": "1970-01-01" + }, + { + "name": "Eid al-Adha Eve", + "date": "1970-02-16" + }, + { + "name": "Eid al-Adha 1. Day", + "date": "1970-02-17" + }, + { + "name": "Eid al-Adha 2. Day", + "date": "1970-02-18" + }, + { + "name": "Eid al-Adha 3. Day", + "date": "1970-02-19" + }, + { + "name": "Eid al-Adha 4. Day", + "date": "1970-02-20" + }, + { + "name": "Mother's Day", + "date": "1970-03-21" + }, + { + "name": "Western Easter", + "date": "1970-03-29" + }, + { + "name": "Independence Day", + "date": "1970-04-17" + }, + { + "name": "Labor Day", + "date": "1970-05-01" + }, + { + "name": "Eastern Easter", + "date": "1970-05-03" + }, + { + "name": "Martyrs' Day", + "date": "1970-05-06" + }, + { + "name": "Anniversary of the October War", + "date": "1970-10-06" + }, + { + "name": "Eid al-Fitr Eve", + "date": "1970-11-30" + }, + { + "name": "Eid al-Fitr 1. Day", + "date": "1970-12-01" + }, + { + "name": "Eid al-Fitr 2. Day", + "date": "1970-12-02" + }, + { + "name": "Eid al-Fitr 3. Day", + "date": "1970-12-03" + }, + { + "name": "Christmas", + "date": "1970-12-25" + } +] \ No newline at end of file diff --git a/tests/.pest/snapshots/Countries/SyriaTest/it_can_calculate_syrian_holidays_with_data_set___2022____2022_.snap b/tests/.pest/snapshots/Countries/SyriaTest/it_can_calculate_syrian_holidays_with_data_set___2022____2022_.snap new file mode 100644 index 000000000..8f82c67ee --- /dev/null +++ b/tests/.pest/snapshots/Countries/SyriaTest/it_can_calculate_syrian_holidays_with_data_set___2022____2022_.snap @@ -0,0 +1,74 @@ +[ + { + "name": "New Year's Day", + "date": "2022-01-01" + }, + { + "name": "Mother's Day", + "date": "2022-03-21" + }, + { + "name": "Independence Day", + "date": "2022-04-17" + }, + { + "name": "Western Easter", + "date": "2022-04-17" + }, + { + "name": "Labor Day", + "date": "2022-05-01" + }, + { + "name": "Eid al-Fitr Eve", + "date": "2022-05-01" + }, + { + "name": "Eid al-Fitr 1. Day", + "date": "2022-05-02" + }, + { + "name": "Eid al-Fitr 2. Day", + "date": "2022-05-03" + }, + { + "name": "Eid al-Fitr 3. Day", + "date": "2022-05-04" + }, + { + "name": "Martyrs' Day", + "date": "2022-05-06" + }, + { + "name": "Eastern Easter", + "date": "2022-05-22" + }, + { + "name": "Eid al-Adha Eve", + "date": "2022-07-08" + }, + { + "name": "Eid al-Adha 1. Day", + "date": "2022-07-09" + }, + { + "name": "Eid al-Adha 2. Day", + "date": "2022-07-10" + }, + { + "name": "Eid al-Adha 3. Day", + "date": "2022-07-11" + }, + { + "name": "Eid al-Adha 4. Day", + "date": "2022-07-12" + }, + { + "name": "Anniversary of the October War", + "date": "2022-10-06" + }, + { + "name": "Christmas", + "date": "2022-12-25" + } +] \ No newline at end of file diff --git a/tests/.pest/snapshots/Countries/SyriaTest/it_can_calculate_syrian_holidays_with_data_set___2023____2023_.snap b/tests/.pest/snapshots/Countries/SyriaTest/it_can_calculate_syrian_holidays_with_data_set___2023____2023_.snap new file mode 100644 index 000000000..9f992fdf5 --- /dev/null +++ b/tests/.pest/snapshots/Countries/SyriaTest/it_can_calculate_syrian_holidays_with_data_set___2023____2023_.snap @@ -0,0 +1,74 @@ +[ + { + "name": "New Year's Day", + "date": "2023-01-01" + }, + { + "name": "Mother's Day", + "date": "2023-03-21" + }, + { + "name": "Western Easter", + "date": "2023-04-09" + }, + { + "name": "Independence Day", + "date": "2023-04-17" + }, + { + "name": "Eid al-Fitr Eve", + "date": "2023-04-20" + }, + { + "name": "Eid al-Fitr 1. Day", + "date": "2023-04-21" + }, + { + "name": "Eid al-Fitr 2. Day", + "date": "2023-04-22" + }, + { + "name": "Eid al-Fitr 3. Day", + "date": "2023-04-23" + }, + { + "name": "Labor Day", + "date": "2023-05-01" + }, + { + "name": "Martyrs' Day", + "date": "2023-05-06" + }, + { + "name": "Eastern Easter", + "date": "2023-05-14" + }, + { + "name": "Eid al-Adha Eve", + "date": "2023-06-27" + }, + { + "name": "Eid al-Adha 1. Day", + "date": "2023-06-28" + }, + { + "name": "Eid al-Adha 2. Day", + "date": "2023-06-29" + }, + { + "name": "Eid al-Adha 3. Day", + "date": "2023-06-30" + }, + { + "name": "Eid al-Adha 4. Day", + "date": "2023-07-01" + }, + { + "name": "Anniversary of the October War", + "date": "2023-10-06" + }, + { + "name": "Christmas", + "date": "2023-12-25" + } +] \ No newline at end of file diff --git a/tests/.pest/snapshots/Countries/SyriaTest/it_can_calculate_syrian_holidays_with_data_set___2024____2024_.snap b/tests/.pest/snapshots/Countries/SyriaTest/it_can_calculate_syrian_holidays_with_data_set___2024____2024_.snap new file mode 100644 index 000000000..48e41deee --- /dev/null +++ b/tests/.pest/snapshots/Countries/SyriaTest/it_can_calculate_syrian_holidays_with_data_set___2024____2024_.snap @@ -0,0 +1,74 @@ +[ + { + "name": "New Year's Day", + "date": "2024-01-01" + }, + { + "name": "Mother's Day", + "date": "2024-03-21" + }, + { + "name": "Western Easter", + "date": "2024-03-31" + }, + { + "name": "Eid al-Fitr Eve", + "date": "2024-04-09" + }, + { + "name": "Eid al-Fitr 1. Day", + "date": "2024-04-10" + }, + { + "name": "Eid al-Fitr 2. Day", + "date": "2024-04-11" + }, + { + "name": "Eid al-Fitr 3. Day", + "date": "2024-04-12" + }, + { + "name": "Independence Day", + "date": "2024-04-17" + }, + { + "name": "Labor Day", + "date": "2024-05-01" + }, + { + "name": "Eastern Easter", + "date": "2024-05-05" + }, + { + "name": "Martyrs' Day", + "date": "2024-05-06" + }, + { + "name": "Eid al-Adha Eve", + "date": "2024-06-15" + }, + { + "name": "Eid al-Adha 1. Day", + "date": "2024-06-16" + }, + { + "name": "Eid al-Adha 2. Day", + "date": "2024-06-17" + }, + { + "name": "Eid al-Adha 3. Day", + "date": "2024-06-18" + }, + { + "name": "Eid al-Adha 4. Day", + "date": "2024-06-19" + }, + { + "name": "Anniversary of the October War", + "date": "2024-10-06" + }, + { + "name": "Christmas", + "date": "2024-12-25" + } +] \ No newline at end of file diff --git a/tests/.pest/snapshots/Countries/SyriaTest/it_can_calculate_syrian_holidays_with_data_set___2037____2037_.snap b/tests/.pest/snapshots/Countries/SyriaTest/it_can_calculate_syrian_holidays_with_data_set___2037____2037_.snap new file mode 100644 index 000000000..ca8800c71 --- /dev/null +++ b/tests/.pest/snapshots/Countries/SyriaTest/it_can_calculate_syrian_holidays_with_data_set___2037____2037_.snap @@ -0,0 +1,74 @@ +[ + { + "name": "New Year's Day", + "date": "2037-01-01" + }, + { + "name": "Eid al-Adha Eve", + "date": "2037-01-25" + }, + { + "name": "Eid al-Adha 1. Day", + "date": "2037-01-26" + }, + { + "name": "Eid al-Adha 2. Day", + "date": "2037-01-27" + }, + { + "name": "Eid al-Adha 3. Day", + "date": "2037-01-28" + }, + { + "name": "Eid al-Adha 4. Day", + "date": "2037-01-29" + }, + { + "name": "Mother's Day", + "date": "2037-03-21" + }, + { + "name": "Western Easter", + "date": "2037-04-05" + }, + { + "name": "Independence Day", + "date": "2037-04-17" + }, + { + "name": "Labor Day", + "date": "2037-05-01" + }, + { + "name": "Martyrs' Day", + "date": "2037-05-06" + }, + { + "name": "Eastern Easter", + "date": "2037-05-10" + }, + { + "name": "Anniversary of the October War", + "date": "2037-10-06" + }, + { + "name": "Eid al-Fitr Eve", + "date": "2037-11-08" + }, + { + "name": "Eid al-Fitr 1. Day", + "date": "2037-11-09" + }, + { + "name": "Eid al-Fitr 2. Day", + "date": "2037-11-10" + }, + { + "name": "Eid al-Fitr 3. Day", + "date": "2037-11-11" + }, + { + "name": "Christmas", + "date": "2037-12-25" + } +] \ No newline at end of file diff --git a/tests/.pest/snapshots/Countries/SyriaTest/it_can_translate_syria_holidays_into_arabic.snap b/tests/.pest/snapshots/Countries/SyriaTest/it_can_translate_syria_holidays_into_arabic.snap deleted file mode 100644 index 297cf12ab..000000000 --- a/tests/.pest/snapshots/Countries/SyriaTest/it_can_translate_syria_holidays_into_arabic.snap +++ /dev/null @@ -1,58 +0,0 @@ -[ - { - "name": "\u064a\u0648\u0645 \u0631\u0623\u0633 \u0627\u0644\u0633\u0646\u0629", - "date": "2024-01-01" - }, - { - "name": "\u0639\u064a\u062f \u0627\u0644\u0623\u0645", - "date": "2024-03-21" - }, - { - "name": "\u0639\u064a\u062f \u0627\u0644\u0645\u0639\u0644\u0645", - "date": "2024-03-21" - }, - { - "name": "\u0639\u064a\u062f \u0627\u0644\u0641\u0635\u062d \u0627\u0644\u063a\u0631\u0628\u064a", - "date": "2024-03-31" - }, - { - "name": "\u0639\u064a\u062f \u0627\u0644\u0641\u0637\u0631 \u0627\u0644\u0633\u0639\u064a\u062f", - "date": "2024-04-10" - }, - { - "name": "\u0639\u064a\u062f \u0627\u0644\u062c\u0644\u0627\u0621 \u0648\u0627\u0633\u062a\u0642\u0644\u0627\u0644 \u0633\u0648\u0631\u064a\u0629", - "date": "2024-04-17" - }, - { - "name": "\u0639\u064a\u062f \u0627\u0644\u0639\u0645\u0627\u0644", - "date": "2024-05-01" - }, - { - "name": "\u0639\u064a\u062f \u0627\u0644\u0641\u0635\u062d \u0627\u0644\u0634\u0631\u0642\u064a", - "date": "2024-05-05" - }, - { - "name": "Martyr\n's Day", - "date": "2024-05-06" - }, - { - "name": "\u0639\u064a\u062f \u0627\u0644\u0623\u0636\u062d\u0649 \u0627\u0644\u0645\u0628\u0627\u0631\u0643", - "date": "2024-06-16" - }, - { - "name": "\u0639\u064a\u062f \u0631\u0623\u0633 \u0627\u0644\u0633\u0646\u0629 \u0627\u0644\u0647\u062c\u0631\u064a\u0629", - "date": "2024-07-07" - }, - { - "name": "\u0639\u064a\u062f \u0645\u0648\u0644\u062f \u0627\u0644\u0631\u0633\u0648\u0644 \u0627\u0644\u0623\u0639\u0638\u0645", - "date": "2024-09-15" - }, - { - "name": "\u0630\u0643\u0631\u0649 \u062d\u0631\u0628 \u062a\u0634\u0631\u064a\u0646 \u0627\u0644\u062a\u062d\u0631\u064a\u0631\u064a\u0629", - "date": "2024-10-06" - }, - { - "name": "Christmas", - "date": "2024-12-25" - } -] \ No newline at end of file diff --git a/tests/.pest/snapshots/Countries/SyriaTest/it_can_translate_syrian_holidays_into_arabic.snap b/tests/.pest/snapshots/Countries/SyriaTest/it_can_translate_syrian_holidays_into_arabic.snap new file mode 100644 index 000000000..50a83391d --- /dev/null +++ b/tests/.pest/snapshots/Countries/SyriaTest/it_can_translate_syrian_holidays_into_arabic.snap @@ -0,0 +1,74 @@ +[ + { + "name": "\u0631\u0623\u0633 \u0627\u0644\u0633\u0646\u0629 \u0627\u0644\u0645\u064a\u0644\u0627\u062f\u064a\u0629", + "date": "2024-01-01" + }, + { + "name": "\u0639\u064a\u062f \u0627\u0644\u0623\u0645", + "date": "2024-03-21" + }, + { + "name": "\u0639\u064a\u062f \u0627\u0644\u0641\u0635\u062d \u0627\u0644\u063a\u0631\u0628\u064a", + "date": "2024-03-31" + }, + { + "name": "\u0644\u064a\u0644\u0629 \u0639\u064a\u062f \u0627\u0644\u0641\u0637\u0631", + "date": "2024-04-09" + }, + { + "name": "\u0639\u064a\u062f \u0627\u0644\u0641\u0637\u0631 \u0627\u0644\u064a\u0648\u0645 \u0627\u0644\u0623\u0648\u0644", + "date": "2024-04-10" + }, + { + "name": "\u0639\u064a\u062f \u0627\u0644\u0641\u0637\u0631 \u0627\u0644\u064a\u0648\u0645 \u0627\u0644\u062b\u0627\u0646\u064a", + "date": "2024-04-11" + }, + { + "name": "\u0639\u064a\u062f \u0627\u0644\u0641\u0637\u0631 \u0627\u0644\u064a\u0648\u0645 \u0627\u0644\u062b\u0627\u0644\u062b", + "date": "2024-04-12" + }, + { + "name": "\u0639\u064a\u062f \u0627\u0644\u0627\u0633\u062a\u0642\u0644\u0627\u0644", + "date": "2024-04-17" + }, + { + "name": "\u0639\u064a\u062f \u0627\u0644\u0639\u0645\u0627\u0644", + "date": "2024-05-01" + }, + { + "name": "\u0639\u064a\u062f \u0627\u0644\u0641\u0635\u062d \u0627\u0644\u0634\u0631\u0642\u064a", + "date": "2024-05-05" + }, + { + "name": "\u0639\u064a\u062f \u0627\u0644\u0634\u0647\u062f\u0627\u0621", + "date": "2024-05-06" + }, + { + "name": "\u0644\u064a\u0644\u0629 \u0639\u064a\u062f \u0627\u0644\u0623\u0636\u062d\u0649", + "date": "2024-06-15" + }, + { + "name": "\u0639\u064a\u062f \u0627\u0644\u0623\u0636\u062d\u0649 \u0627\u0644\u064a\u0648\u0645 \u0627\u0644\u0623\u0648\u0644", + "date": "2024-06-16" + }, + { + "name": "\u0639\u064a\u062f \u0627\u0644\u0623\u0636\u062d\u0649 \u0627\u0644\u064a\u0648\u0645 \u0627\u0644\u062b\u0627\u0646\u064a", + "date": "2024-06-17" + }, + { + "name": "\u0639\u064a\u062f \u0627\u0644\u0623\u0636\u062d\u0649 \u0627\u0644\u064a\u0648\u0645 \u0627\u0644\u062b\u0627\u0644\u062b", + "date": "2024-06-18" + }, + { + "name": "\u0639\u064a\u062f \u0627\u0644\u0623\u0636\u062d\u0649 \u0627\u0644\u064a\u0648\u0645 \u0627\u0644\u0631\u0627\u0628\u0639", + "date": "2024-06-19" + }, + { + "name": "\u0630\u0643\u0631\u0649 \u062d\u0631\u0628 \u062a\u0634\u0631\u064a\u0646 \u0627\u0644\u062a\u062d\u0631\u064a\u0631\u064a\u0629", + "date": "2024-10-06" + }, + { + "name": "\u0639\u064a\u062f \u0627\u0644\u0645\u064a\u0644\u0627\u062f \u0627\u0644\u0645\u062c\u064a\u062f", + "date": "2024-12-25" + } +] \ No newline at end of file diff --git a/tests/Countries/SyriaTest.php b/tests/Countries/SyriaTest.php index 6bf5ed7df..e21e01193 100644 --- a/tests/Countries/SyriaTest.php +++ b/tests/Countries/SyriaTest.php @@ -5,8 +5,8 @@ use Carbon\CarbonImmutable; use Spatie\Holidays\Holidays; -it('can calculate syria holidays', function () { - CarbonImmutable::setTestNowAndTimezone('2024-01-01'); +it('can calculate syrian holidays', function ($year) { + CarbonImmutable::setTestNow($year.'-01-01'); $holidays = Holidays::for(country: 'sy')->get(); @@ -14,9 +14,12 @@ ->toBeArray() ->not()->toBeEmpty() ->and(formatDates($holidays))->toMatchSnapshot(); -}); -it('can translate syria holidays into arabic', function () { +})->with([1970, 2022, 2023, 2024, 2037]); + +it('can translate syrian holidays into arabic', function () { + $holidays = Holidays::for(country: 'sy', year: 2024, locale: 'ar')->get(); + expect($holidays) ->toBeArray() ->not()->toBeEmpty();