From 663a130de5701ac27dd6a0066967d2b9607942a0 Mon Sep 17 00:00:00 2001 From: Nessim Abadi Date: Thu, 18 Jan 2024 14:30:07 -0500 Subject: [PATCH 1/3] Create Panama.php Create country file --- src/Countries/Panama.php | 43 ++++++++++++++++++++++++++++++++++++++++ 1 file changed, 43 insertions(+) create mode 100644 src/Countries/Panama.php diff --git a/src/Countries/Panama.php b/src/Countries/Panama.php new file mode 100644 index 000000000..554b218c7 --- /dev/null +++ b/src/Countries/Panama.php @@ -0,0 +1,43 @@ + '01-01', + 'Día de los Mártires' => '01-09', + 'Día del Trabajo' => '05-01', + 'Separación de Panamá de Colombia' => '11-03', + 'Día de Colón' => '11-05', + 'Grito de independencia de La Villa de Los Santos' => '11-10', + 'Independencia de Panamá de España' => '11-25', + 'Día de la Madre' => '12-08', + 'Duelo Nacional por la Invasión de Estados Unidos a Panamá' => '12-20', + 'Navidad' => '12-25', + ], $this->variableHolidays($year)); + } + + /** @return array */ + protected function variableHolidays(int $year): array + { + $easter = CarbonImmutable::createFromTimestamp(easter_date($year)) + ->setTimezone('America/Panama'); + + return [ + 'Jueves Santo' => $easter->subDays(3), + 'Viernes Santo' => $easter->subDays(2), + 'Sábado de Gloria' => $easter->subDays(1), + ]; + } +} From 9ecd585aa47ce485066d1bede0843169fa0ac607 Mon Sep 17 00:00:00 2001 From: Nessim Abadi Date: Thu, 18 Jan 2024 14:38:06 -0500 Subject: [PATCH 2/3] Create it_can_calculate_panama_holidays.snap Add snap file --- .../it_can_calculate_panama_holidays.snap | 50 +++++++++++++++++++ 1 file changed, 50 insertions(+) create mode 100644 tests/.pest/snapshots/Countries/PanamaTest/it_can_calculate_panama_holidays.snap diff --git a/tests/.pest/snapshots/Countries/PanamaTest/it_can_calculate_panama_holidays.snap b/tests/.pest/snapshots/Countries/PanamaTest/it_can_calculate_panama_holidays.snap new file mode 100644 index 000000000..ae73ce010 --- /dev/null +++ b/tests/.pest/snapshots/Countries/PanamaTest/it_can_calculate_panama_holidays.snap @@ -0,0 +1,50 @@ +[ + { + "name": "A\u00f1o Nuevo", + "date": "2024-01-01" + }, + { + "name": "D\u00eda de los M\u00e1rtires", + "date": "2024-01-09" + }, + { + "name": "Viernes Santo", + "date": "2024-03-28" + }, + { + "name": "S\u00e1bado de Gloria", + "date": "2024-03-29" + }, + { + "name": "D\u00eda del Trabajo", + "date": "2024-05-01" + }, + { + "name": "Separación de Panamá de Colombia", + "date": "2024-11-03" + }, + { + "name": "D\u00eda de Col\u00f3n", + "date": "2024-11-05" + }, + { + "name": "Grito de independencia de La Villa de Los Santos", + "date": "2024-11-10" + }, + { + "name": "Independencia de Panam\u00e1 de Espa\00f1a", + "date": "2024-11-28" + }, + { + "name": "D\u00eda de la Madre", + "date": "2024-12-08" + }, + { + "name": "Duelo Nacional por la Invasi\u00f3n de Estados Unidos a Panam\u00e1", + "date": "2024-12-20" + }, + { + "name": "Navidad", + "date": "2024-12-25" + } +] From f6f2b441f1a2b45acd915d7cbb5df9d2467951bc Mon Sep 17 00:00:00 2001 From: Nessim Abadi Date: Thu, 18 Jan 2024 14:38:47 -0500 Subject: [PATCH 3/3] Create PanamaTest.php Add test file --- tests/Countries/PanamaTest.php | 18 ++++++++++++++++++ 1 file changed, 18 insertions(+) create mode 100644 tests/Countries/PanamaTest.php diff --git a/tests/Countries/PanamaTest.php b/tests/Countries/PanamaTest.php new file mode 100644 index 000000000..f848a26f2 --- /dev/null +++ b/tests/Countries/PanamaTest.php @@ -0,0 +1,18 @@ +get(); + + expect($holidays) + ->toBeArray() + ->not()->toBeEmpty(); + + expect(formatDates($holidays))->toMatchSnapshot(); +});