From 106d97c1d05c080079f7bf8c8d67df064465d3f8 Mon Sep 17 00:00:00 2001 From: jul6art Date: Mon, 9 Nov 2020 19:12:43 +0100 Subject: [PATCH] Added Belgian holidays --- README.md | 1 + src/Provider/BE.php | 35 +++++++++++++++++++++++++++++++++++ test/Provider/BETest.php | 40 ++++++++++++++++++++++++++++++++++++++++ 3 files changed, 76 insertions(+) create mode 100644 src/Provider/BE.php create mode 100644 test/Provider/BETest.php diff --git a/README.md b/README.md index 3499462..260fb8b 100644 --- a/README.md +++ b/README.md @@ -6,6 +6,7 @@ Checkdomain/Holiday is a small library to check if a specified date is a holiday ## Currently supported countries - 🇦🇹 **AT** Austria +- 🇧🇪 **BE** Belgium - 🇧🇷 **BR** Brazil - 🇩🇪 **DE** Germany - 🇩🇰 **DK** Denmark diff --git a/src/Provider/BE.php b/src/Provider/BE.php new file mode 100644 index 0000000..17b4cd0 --- /dev/null +++ b/src/Provider/BE.php @@ -0,0 +1,35 @@ + + * @since 2020-11-09 + */ +class BE extends AbstractEaster +{ + /** + * @param int $year + * + * @return mixed + */ + public function getHolidaysByYear($year) + { + $easter = $this->getEasterDates($year); + + return [ + '01-01' => $this->createData('Jour de l\'an'), + '05-01' => $this->createData('Fête du Travail'), + '07-21' => $this->createData('Fête Nationale'), + '08-15' => $this->createData('Assomption'), + '11-01' => $this->createData('Toussaint'), + '11-11' => $this->createData('Armistice'), + '12-25' => $this->createData('Noël'), + $easter['easterMonday']->format(self::DATE_FORMAT) => $this->createData('Lundi de Pâques'), + $easter['ascensionDay']->format(self::DATE_FORMAT) => $this->createData('Jeudi de l\'Ascension'), + $easter['pentecostMonday']->format(self::DATE_FORMAT) => $this->createData('Lundi de Pentecôte'), + ]; + } +} diff --git a/test/Provider/BETest.php b/test/Provider/BETest.php new file mode 100644 index 0000000..af865d9 --- /dev/null +++ b/test/Provider/BETest.php @@ -0,0 +1,40 @@ +provider = new BE(); + } + + /** + * Provides some test dates and the expectation + * + * @return array + */ + public function dateProvider() + { + return array( + array('2017-03-21', null, null), + array('2017-01-01', null, array('name' => 'Jour de l\'an')), + array('2017-04-17', null, array('name' => 'Lundi de Pâques')), + array('2017-05-01', null, array('name' => 'Fête du Travail')), + array('2017-05-09', null, null), + array('2017-05-25', null, array('name' => 'Jeudi de l\'Ascension')), + array('2017-06-05', null, array('name' => 'Lundi de Pentecôte')), + array('2017-07-21', null, array('name' => 'Fête Nationale')), + array('2017-08-15', null, array('name' => 'Assomption')), + array('2017-11-01', null, array('name' => 'Toussaint')), + array('2017-11-11', null, array('name' => 'Armistice')), + array('2017-12-25', null, array('name' => 'Noël')), + ); + } +}