From eb23f4dafe7362709ebb3304acf24d38692d4fa1 Mon Sep 17 00:00:00 2001 From: Mazin-Ibrahim Date: Thu, 25 Jan 2024 11:56:15 +0300 Subject: [PATCH 1/2] [ADD] sudan public holidays --- src/Countries/Sudan.php | 31 +++++++++++++++++++++++++++++++ tests/Countries/SudanTest.php | 18 ++++++++++++++++++ 2 files changed, 49 insertions(+) create mode 100644 src/Countries/Sudan.php create mode 100644 tests/Countries/SudanTest.php diff --git a/src/Countries/Sudan.php b/src/Countries/Sudan.php new file mode 100644 index 000000000..190b891ca --- /dev/null +++ b/src/Countries/Sudan.php @@ -0,0 +1,31 @@ + '01-01', + 'International Workers Day' => '05-01' + ], $this->variableHolidays($year)); + } + + + /** @return array */ + protected function variableHolidays(int $year): array + { + $easter = $this->easter($year); + + return [ + 'weekend' => $easter->subDays(2) + ]; + } +} diff --git a/tests/Countries/SudanTest.php b/tests/Countries/SudanTest.php new file mode 100644 index 000000000..66e1d0ac3 --- /dev/null +++ b/tests/Countries/SudanTest.php @@ -0,0 +1,18 @@ +get(); + + expect($holidays) + ->toBeArray() + ->not()->toBeEmpty(); + + expect(formatDates($holidays))->toMatchSnapshot(); +}); \ No newline at end of file From c048cce4e427a3e4efe67eb446f377eaea4cf4db Mon Sep 17 00:00:00 2001 From: Mazin-Ibrahim Date: Thu, 25 Jan 2024 16:23:51 +0300 Subject: [PATCH 2/2] [FIX] issues sudan public holidays --- src/Countries/Sudan.php | 26 +++++++++++++------------- 1 file changed, 13 insertions(+), 13 deletions(-) diff --git a/src/Countries/Sudan.php b/src/Countries/Sudan.php index 190b891ca..a60128d32 100644 --- a/src/Countries/Sudan.php +++ b/src/Countries/Sudan.php @@ -2,6 +2,8 @@ namespace Spatie\Holidays\Countries; +use Carbon\CarbonImmutable; + class Sudan extends Country { public function countryCode(): string @@ -9,23 +11,21 @@ public function countryCode(): string return 'sd'; } - protected function allHolidays(int $year): array { return array_merge([ + "New Year's Day" => '01-01', 'Independence Day' => '01-01', - 'International Workers Day' => '05-01' + 'Labour Day' => '05-01', + 'Christmas Day' => '12-25' ], $this->variableHolidays($year)); } - - /** @return array */ - protected function variableHolidays(int $year): array - { - $easter = $this->easter($year); - - return [ - 'weekend' => $easter->subDays(2) - ]; - } -} + /** + * @return array + */ + private function variableHolidays(int $year): array + { + return []; + } +} \ No newline at end of file