diff --git a/src/Countries/Kenya.php b/src/Countries/Kenya.php new file mode 100644 index 000000000..f4c506648 --- /dev/null +++ b/src/Countries/Kenya.php @@ -0,0 +1,39 @@ + "01-01", + "Labour" => "05-01", + "Madaraka" => "06-01", + "Utamaduni" => "10-10", + "Mashujaa" => "10-20", + "Jamhuri" => "12-01", + "Christmas" => "12-25", + "Boxing" => "12-26", + ], $this->variableHolidays($year)); + } + + /** @return array */ + protected function variableHolidays(int $year): array + { + $easter = CarbonImmutable::createFromTimestamp(easter_date($year)) + ->setTimezone('Africa/Nairobi'); + + return [ + "Good Friday" => $easter->subDays(2), + "Easter Monday" => $easter->addDay(), + ]; + } +} diff --git a/tests/.pest/snapshots/Countries/KenyaTest/it_can_calculate_kenyan_holidays.snap b/tests/.pest/snapshots/Countries/KenyaTest/it_can_calculate_kenyan_holidays.snap new file mode 100644 index 000000000..8ca55adb8 --- /dev/null +++ b/tests/.pest/snapshots/Countries/KenyaTest/it_can_calculate_kenyan_holidays.snap @@ -0,0 +1,42 @@ +[ + { + "name": "New Year's", + "date": "2024-01-01" + }, + { + "name": "Good Friday", + "date": "2024-03-29" + }, + { + "name": "Easter Monday", + "date": "2024-04-01" + }, + { + "name": "Labour", + "date": "2024-05-01" + }, + { + "name": "Madaraka", + "date": "2024-06-01" + }, + { + "name": "Utamaduni", + "date": "2024-10-10" + }, + { + "name": "Mashujaa", + "date": "2024-10-20" + }, + { + "name": "Jamhuri", + "date": "2024-12-01" + }, + { + "name": "Christmas", + "date": "2024-12-25" + }, + { + "name": "Boxing", + "date": "2024-12-26" + } +] \ No newline at end of file diff --git a/tests/Countries/KenyaTest.php b/tests/Countries/KenyaTest.php new file mode 100644 index 000000000..96d17cdf3 --- /dev/null +++ b/tests/Countries/KenyaTest.php @@ -0,0 +1,18 @@ +get(); + + expect($holidays) + ->toBeArray() + ->not()->toBeEmpty(); + + expect(formatDates($holidays))->toMatchSnapshot(); +});