From b45dd8e88bc9ea2b80d3b99830093809d42ebe89 Mon Sep 17 00:00:00 2001 From: Eimantas Likas Date: Mon, 22 Jan 2024 13:30:34 +0200 Subject: [PATCH] Add Lithuanian holidays --- src/Countries/Lithuania.php | 42 ++++++++++++++ .../it_can_calculate_lithuanian_holidays.snap | 58 +++++++++++++++++++ tests/Countries/LithuaniaTest.php | 18 ++++++ 3 files changed, 118 insertions(+) create mode 100644 src/Countries/Lithuania.php create mode 100644 tests/.pest/snapshots/Countries/LithuaniaTest/it_can_calculate_lithuanian_holidays.snap create mode 100644 tests/Countries/LithuaniaTest.php diff --git a/src/Countries/Lithuania.php b/src/Countries/Lithuania.php new file mode 100644 index 000000000..3b78d60cb --- /dev/null +++ b/src/Countries/Lithuania.php @@ -0,0 +1,42 @@ + '01-01', + 'Lietuvos valstybės atkūrimo diena' => '02-16', + 'Nepriklausomybės atkūrimo diena' => '03-11', + 'Tarptautinė darbo diena' => '05-01', + 'Joninės' => '06-24', + 'Karaliaus Mindaugo karūnavimo diena' => '07-06', + 'Žolinė' => '08-15', + 'Visų šventųjų diena' => '11-01', + 'Vėlinės' => '11-02', + 'Šv. Kūčios' => '12-24', + 'Šv. Kalėdos' => '12-25', + 'Šv. Kalėdų antroji diena' => '12-26', + ], $this->variableHolidays($year)); + } + + /** @return array */ + protected function variableHolidays(int $year): array + { + $easter = $this->easter($year); + + return [ + 'Velykos' => $easter, + 'Velykų antroji diena' => $easter->addDay(), + ]; + } +} diff --git a/tests/.pest/snapshots/Countries/LithuaniaTest/it_can_calculate_lithuanian_holidays.snap b/tests/.pest/snapshots/Countries/LithuaniaTest/it_can_calculate_lithuanian_holidays.snap new file mode 100644 index 000000000..40fe82dfa --- /dev/null +++ b/tests/.pest/snapshots/Countries/LithuaniaTest/it_can_calculate_lithuanian_holidays.snap @@ -0,0 +1,58 @@ +[ + { + "name": "Naujieji metai", + "date": "2024-01-01" + }, + { + "name": "Lietuvos valstyb\u0117s atk\u016brimo diena", + "date": "2024-02-16" + }, + { + "name": "Nepriklausomyb\u0117s atk\u016brimo diena", + "date": "2024-03-11" + }, + { + "name": "Velykos", + "date": "2024-03-31" + }, + { + "name": "Velyk\u0173 antroji diena", + "date": "2024-04-01" + }, + { + "name": "Tarptautin\u0117 darbo diena", + "date": "2024-05-01" + }, + { + "name": "Jonin\u0117s", + "date": "2024-06-24" + }, + { + "name": "Karaliaus Mindaugo kar\u016bnavimo diena", + "date": "2024-07-06" + }, + { + "name": "\u017dolin\u0117", + "date": "2024-08-15" + }, + { + "name": "Vis\u0173 \u0161vent\u0173j\u0173 diena", + "date": "2024-11-01" + }, + { + "name": "V\u0117lin\u0117s", + "date": "2024-11-02" + }, + { + "name": "\u0160v. K\u016b\u010dios", + "date": "2024-12-24" + }, + { + "name": "\u0160v. Kal\u0117dos", + "date": "2024-12-25" + }, + { + "name": "\u0160v. Kal\u0117d\u0173 antroji diena", + "date": "2024-12-26" + } +] \ No newline at end of file diff --git a/tests/Countries/LithuaniaTest.php b/tests/Countries/LithuaniaTest.php new file mode 100644 index 000000000..310f58f5b --- /dev/null +++ b/tests/Countries/LithuaniaTest.php @@ -0,0 +1,18 @@ +get(); + + expect($holidays) + ->toBeArray() + ->not()->toBeEmpty(); + + expect(formatDates($holidays))->toMatchSnapshot(); +});