From c230c890af07962c5e5e1e59dc1fa0e8c2e0f130 Mon Sep 17 00:00:00 2001 From: HAMAD ABDULLA Date: Fri, 19 Jan 2024 01:53:11 +0300 Subject: [PATCH] Added Bahrain holidays --- src/Countries/Bahrain.php | 43 ++++++++++++++ .../it_can_calculate_bahrain_holidays.snap | 58 +++++++++++++++++++ tests/Countries/BahrainTest.php | 18 ++++++ 3 files changed, 119 insertions(+) create mode 100644 src/Countries/Bahrain.php create mode 100644 tests/.pest/snapshots/Countries/BahrainTest/it_can_calculate_bahrain_holidays.snap create mode 100644 tests/Countries/BahrainTest.php diff --git a/src/Countries/Bahrain.php b/src/Countries/Bahrain.php new file mode 100644 index 000000000..e8973d811 --- /dev/null +++ b/src/Countries/Bahrain.php @@ -0,0 +1,43 @@ + '01-01', + 'Eid al Fitr Holiday 1' => '04-10', + 'Eid al Fitr Holiday 2' => '04-11', + 'Eid al Fitr Holiday 3' => '04-12', + 'Labour Day' => '05-01', + 'Eid al Adha Holiday 1' => '06-16', + 'Eid al Adha Holiday 2' => '06-17', + 'Eid al Adha Holiday 3' => '06-18', + 'Islamic New Year' => '07-07', + 'Ashura Holiday 1' => '07-16', + 'Ashura Holiday 2' => '07-17', + 'Prophet Muhammads Birthday' => '07-15', + 'National Day' => '12-16', + 'National Day Holiday' => '12-17', + ], $this->variableHolidays($year)); + } + + /** @return array */ + protected function variableHolidays(int $year): array + { + $easter = CarbonImmutable::createFromTimestamp(easter_date($year))->setTimezone('Asia/Bahrain'); + + return []; + } +} diff --git a/tests/.pest/snapshots/Countries/BahrainTest/it_can_calculate_bahrain_holidays.snap b/tests/.pest/snapshots/Countries/BahrainTest/it_can_calculate_bahrain_holidays.snap new file mode 100644 index 000000000..4868cd636 --- /dev/null +++ b/tests/.pest/snapshots/Countries/BahrainTest/it_can_calculate_bahrain_holidays.snap @@ -0,0 +1,58 @@ +[ + { + "name": "New Year Day", + "date": "2024-01-01" + }, + { + "name": "Eid al Fitr Holiday 1", + "date": "2024-04-10" + }, + { + "name": "Eid al Fitr Holiday 2", + "date": "2024-04-11" + }, + { + "name": "Eid al Fitr Holiday 3", + "date": "2024-04-12" + }, + { + "name": "Labour Day", + "date": "2024-05-01" + }, + { + "name": "Eid al Adha Holiday 1", + "date": "2024-06-16" + }, + { + "name": "Eid al Adha Holiday 2", + "date": "2024-06-17" + }, + { + "name": "Eid al Adha Holiday 3", + "date": "2024-06-18" + }, + { + "name": "Islamic New Year", + "date": "2024-07-07" + }, + { + "name": "Ashura Holiday 1", + "date": "2024-07-16" + }, + { + "name": "Ashura Holiday 2", + "date": "2024-07-17" + }, + { + "name": "Prophet Muhammads Birthday", + "date": "2024-07-15" + }, + { + "name": "National Day", + "date": "2024-12-16" + }, + { + "name": "National Day Holiday", + "date": "2024-12-17" + } +] diff --git a/tests/Countries/BahrainTest.php b/tests/Countries/BahrainTest.php new file mode 100644 index 000000000..7349f88f2 --- /dev/null +++ b/tests/Countries/BahrainTest.php @@ -0,0 +1,18 @@ +get(); + + expect($holidays) + ->toBeArray() + ->not()->toBeEmpty(); + + expect(formatDates($holidays))->toMatchSnapshot(); +});