Skip to content

Commit

Permalink
Merge pull request #48 from jul6art/master
Browse files Browse the repository at this point in the history
Added Belgian holidays
  • Loading branch information
FlorianKoerner authored Dec 24, 2020
2 parents 77a71ba + 106d97c commit cb002c0
Show file tree
Hide file tree
Showing 3 changed files with 76 additions and 0 deletions.
1 change: 1 addition & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
35 changes: 35 additions & 0 deletions src/Provider/BE.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,35 @@
<?php

namespace Checkdomain\Holiday\Provider;

/**
* Belgian holiday provider
*
* @author Jul6art <[email protected]>
* @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'),
];
}
}
40 changes: 40 additions & 0 deletions test/Provider/BETest.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,40 @@
<?php

namespace Checkdomain\Holiday\Provider;

/**
* Class BETest
*/
class BETest extends AbstractTest
{
/**
* {@inheritDoc}
*/
public function setUp()
{
$this->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')),
);
}
}

0 comments on commit cb002c0

Please sign in to comment.