diff --git a/src/Countries/Poland.php b/src/Countries/Poland.php new file mode 100644 index 000000000..b6e111ebe --- /dev/null +++ b/src/Countries/Poland.php @@ -0,0 +1,42 @@ + */ + protected function allHolidays(int $year): array + { + return array_merge([ + 'Nowy Rok' => '01-01', + 'Święto Trzech Króli' => '01-06', + 'Święto Pracy' => '05-01', + 'Święto Konstytucji 3 Maja' => '05-03', + 'Święto Wojska Polskiego, Wniebowzięcie Najświętszej Maryi Panny' => '08-15', + 'Wszystkich Świętych' => '11-01', + 'Święto Niepodległości' => '11-11', + 'Boże Narodzenie' => '12-25', + 'Drugi Dzień Bożego Narodzenia' => '12-26', + ], $this->variableHolidays($year)); + } + + /** @return array */ + protected function variableHolidays(int $year): array + { + $easter = CarbonImmutable::createFromTimestamp(easter_date($year))->setTimezone('Europe/Warsaw'); + + return [ + 'Wielkanoc' => $easter, + 'Poniedziałek Wielkanocny' => $easter->addDay(), + 'Zielone Świątki' => $easter->addWeeks(7), + 'Boże Ciało' => $easter->addDays(60), + ]; + } +} diff --git a/tests/.pest/snapshots/Countries/PolandTest/it_can_calculate_polish_holidays.snap b/tests/.pest/snapshots/Countries/PolandTest/it_can_calculate_polish_holidays.snap new file mode 100644 index 000000000..a14c2115a --- /dev/null +++ b/tests/.pest/snapshots/Countries/PolandTest/it_can_calculate_polish_holidays.snap @@ -0,0 +1,54 @@ +[ + { + "name": "Nowy Rok", + "date": "2024-01-01" + }, + { + "name": "\u015awi\u0119to Trzech Kr\u00f3li", + "date": "2024-01-06" + }, + { + "name": "Wielkanoc", + "date": "2024-03-31" + }, + { + "name": "Poniedzia\u0142ek Wielkanocny", + "date": "2024-04-01" + }, + { + "name": "\u015awi\u0119to Pracy", + "date": "2024-05-01" + }, + { + "name": "\u015awi\u0119to Konstytucji 3 Maja", + "date": "2024-05-03" + }, + { + "name": "Zielone \u015awi\u0105tki", + "date": "2024-05-19" + }, + { + "name": "Bo\u017ce Cia\u0142o", + "date": "2024-05-30" + }, + { + "name": "\u015awi\u0119to Wojska Polskiego, Wniebowzi\u0119cie Naj\u015bwi\u0119tszej Maryi Panny", + "date": "2024-08-15" + }, + { + "name": "Wszystkich \u015awi\u0119tych", + "date": "2024-11-01" + }, + { + "name": "\u015awi\u0119to Niepodleg\u0142o\u015bci", + "date": "2024-11-11" + }, + { + "name": "Bo\u017ce Narodzenie", + "date": "2024-12-25" + }, + { + "name": "Drugi Dzie\u0144 Bo\u017cego Narodzenia", + "date": "2024-12-26" + } +] \ No newline at end of file diff --git a/tests/Countries/PolandTest.php b/tests/Countries/PolandTest.php new file mode 100644 index 000000000..25a75ebc7 --- /dev/null +++ b/tests/Countries/PolandTest.php @@ -0,0 +1,18 @@ +get(); + + expect($holidays) + ->toBeArray() + ->not()->toBeEmpty(); + + expect(formatDates($holidays))->toMatchSnapshot(); +});