diff --git a/src/Countries/Andorra.php b/src/Countries/Andorra.php new file mode 100644 index 000000000..19e342ca5 --- /dev/null +++ b/src/Countries/Andorra.php @@ -0,0 +1,43 @@ + */ + protected function allHolidays(int $year): array + { + return array_merge([ + 'Any nou' => '01-01', + 'Reis' => '01-06', + 'Dia de la Constitució' => '03-14', + 'Festa del Treball' => '05-01', + 'Assumpció' => '08-15', + 'Mare de Déu de Meritxell' => '09-08', + 'Tots Sants' => '11-01', + 'Immaculada Concepció' => '11-08', + 'Nadal' => '12-25', + 'Sant Esteve' => '12-26', + ], $this->variableHolidays($year)); + } + + /** @return array */ + protected function variableHolidays(int $year): array + { + $easter = CarbonImmutable::createFromTimestamp(easter_date($year)) + ->setTimezone('Europe/Brussels'); + + return [ + 'Divendres Sant' => $easter->subDays(2), + 'Dilluns de Pasqua' => $easter->addDay(), + 'Dilluns de Pentecosta' => $easter->addDays(50), + ]; + } +} diff --git a/tests/.pest/snapshots/Countries/AndorraTest/it_can_calculate_andorra_holidays.snap b/tests/.pest/snapshots/Countries/AndorraTest/it_can_calculate_andorra_holidays.snap new file mode 100644 index 000000000..b46fb624f --- /dev/null +++ b/tests/.pest/snapshots/Countries/AndorraTest/it_can_calculate_andorra_holidays.snap @@ -0,0 +1,54 @@ +[ + { + "name": "Any nou", + "date": "2024-01-01" + }, + { + "name": "Reis", + "date": "2024-01-06" + }, + { + "name": "Dia de la Constituci\u00f3", + "date": "2024-03-14" + }, + { + "name": "Divendres Sant", + "date": "2024-03-29" + }, + { + "name": "Dilluns de Pasqua", + "date": "2024-04-01" + }, + { + "name": "Festa del Treball", + "date": "2024-05-01" + }, + { + "name": "Dilluns de Pentecosta", + "date": "2024-05-20" + }, + { + "name": "Assumpci\u00f3", + "date": "2024-08-15" + }, + { + "name": "Mare de D\u00e9u de Meritxell", + "date": "2024-09-08" + }, + { + "name": "Tots Sants", + "date": "2024-11-01" + }, + { + "name": "Immaculada Concepci\u00f3", + "date": "2024-11-08" + }, + { + "name": "Nadal", + "date": "2024-12-25" + }, + { + "name": "Sant Esteve", + "date": "2024-12-26" + } +] \ No newline at end of file diff --git a/tests/Countries/AndorraTest.php b/tests/Countries/AndorraTest.php new file mode 100644 index 000000000..6ab6d869e --- /dev/null +++ b/tests/Countries/AndorraTest.php @@ -0,0 +1,18 @@ +get(); + + expect($holidays) + ->toBeArray() + ->not()->toBeEmpty(); + + expect(formatDates($holidays))->toMatchSnapshot(); +}); \ No newline at end of file