Skip to content

Commit 106d97c

Browse files
committed
Added Belgian holidays
1 parent b58ad2d commit 106d97c

File tree

3 files changed

+76
-0
lines changed

3 files changed

+76
-0
lines changed

README.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,7 @@ Checkdomain/Holiday is a small library to check if a specified date is a holiday
66
## Currently supported countries
77

88
- 🇦🇹 **AT** Austria
9+
- 🇧🇪 **BE** Belgium
910
- 🇧🇷 **BR** Brazil
1011
- 🇩🇪 **DE** Germany
1112
- 🇩🇰 **DK** Denmark

src/Provider/BE.php

Lines changed: 35 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,35 @@
1+
<?php
2+
3+
namespace Checkdomain\Holiday\Provider;
4+
5+
/**
6+
* Belgian holiday provider
7+
*
8+
* @author Jul6art <admin@devinthehood.com>
9+
* @since 2020-11-09
10+
*/
11+
class BE extends AbstractEaster
12+
{
13+
/**
14+
* @param int $year
15+
*
16+
* @return mixed
17+
*/
18+
public function getHolidaysByYear($year)
19+
{
20+
$easter = $this->getEasterDates($year);
21+
22+
return [
23+
'01-01' => $this->createData('Jour de l\'an'),
24+
'05-01' => $this->createData('Fête du Travail'),
25+
'07-21' => $this->createData('Fête Nationale'),
26+
'08-15' => $this->createData('Assomption'),
27+
'11-01' => $this->createData('Toussaint'),
28+
'11-11' => $this->createData('Armistice'),
29+
'12-25' => $this->createData('Noël'),
30+
$easter['easterMonday']->format(self::DATE_FORMAT) => $this->createData('Lundi de Pâques'),
31+
$easter['ascensionDay']->format(self::DATE_FORMAT) => $this->createData('Jeudi de l\'Ascension'),
32+
$easter['pentecostMonday']->format(self::DATE_FORMAT) => $this->createData('Lundi de Pentecôte'),
33+
];
34+
}
35+
}

test/Provider/BETest.php

Lines changed: 40 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,40 @@
1+
<?php
2+
3+
namespace Checkdomain\Holiday\Provider;
4+
5+
/**
6+
* Class BETest
7+
*/
8+
class BETest extends AbstractTest
9+
{
10+
/**
11+
* {@inheritDoc}
12+
*/
13+
public function setUp()
14+
{
15+
$this->provider = new BE();
16+
}
17+
18+
/**
19+
* Provides some test dates and the expectation
20+
*
21+
* @return array
22+
*/
23+
public function dateProvider()
24+
{
25+
return array(
26+
array('2017-03-21', null, null),
27+
array('2017-01-01', null, array('name' => 'Jour de l\'an')),
28+
array('2017-04-17', null, array('name' => 'Lundi de Pâques')),
29+
array('2017-05-01', null, array('name' => 'Fête du Travail')),
30+
array('2017-05-09', null, null),
31+
array('2017-05-25', null, array('name' => 'Jeudi de l\'Ascension')),
32+
array('2017-06-05', null, array('name' => 'Lundi de Pentecôte')),
33+
array('2017-07-21', null, array('name' => 'Fête Nationale')),
34+
array('2017-08-15', null, array('name' => 'Assomption')),
35+
array('2017-11-01', null, array('name' => 'Toussaint')),
36+
array('2017-11-11', null, array('name' => 'Armistice')),
37+
array('2017-12-25', null, array('name' => 'Noël')),
38+
);
39+
}
40+
}

0 commit comments

Comments
 (0)