From 5c136b882e478158c2a34759603314a91f46fabd Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Florian=20Ko=CC=88rner?= Date: Wed, 5 Jul 2017 20:16:54 +0200 Subject: [PATCH] Fix #18: I18n Support --- README.md | 48 ++++++---- tests/Checkdomain/Holiday/Provider/ATTest.php | 52 +++++------ .../Holiday/Provider/AbstractTest.php | 2 +- tests/Checkdomain/Holiday/Provider/DETest.php | 16 ++-- tests/Checkdomain/Holiday/Provider/DKTest.php | 22 ++--- tests/Checkdomain/Holiday/Provider/FRTest.php | 24 ++--- tests/Checkdomain/Holiday/Provider/ITTest.php | 20 ++-- tests/Checkdomain/Holiday/Provider/NOTest.php | 72 +++++++-------- tests/Checkdomain/Holiday/Provider/PLTest.php | 20 ++-- tests/Checkdomain/Holiday/Provider/PTTest.php | 26 +++--- tests/Checkdomain/Holiday/Provider/SETest.php | 92 +++++++++---------- tests/Checkdomain/Holiday/UtilTest.php | 8 +- 12 files changed, 208 insertions(+), 194 deletions(-) diff --git a/README.md b/README.md index 064ebf6..0dead1d 100644 --- a/README.md +++ b/README.md @@ -1,16 +1,34 @@ -README [![Build Status](https://travis-ci.org/checkdomain/Holiday.png?branch=master)](https://travis-ci.org/checkdomain/Holiday) -====== +# checkdomain Holiday [![Build Status](https://travis-ci.org/checkdomain/Holiday.png?branch=master)](https://travis-ci.org/checkdomain/Holiday) -What is Checkdomain/Holiday ---------------------------- Checkdomain/Holiday is a small library to check if a specified date is a holiday in a specific country. It also tells you if the given date is a nation wide holiday or just a holiday in some states. -Requirements ------------- + +## Currently supported countries + +- **AT** Austria +- **DE** Germany +- **DK** Denmark +- **FR** France +- **IT** Italy +- **NO** Norway +- **PL** Poland +- **PT** Portugal +- **SE** Sweden + +## Your country is not supported? + +checkdomain Holiday is open source. If you use this library it would be great to get some support for currently not implemented countries which you are familiar with. Pull requests will be reviewed and merged fast. + +To create a new Provider please see the `ProviderInterface` interface. + + +## Requirements + Checkdomain/Holiday requires php >= 5.3. -Installation ------------- + +## Installation + The easiest way to install this library is through [composer](http://getcomposer.org/). Just add the following lines to your **composer.json** file: ```json @@ -23,25 +41,21 @@ The easiest way to install this library is through [composer](http://getcomposer Another way would be to download this library and configure the autoloading yourself. This library relies on a [PSR-0](https://github.com/php-fig/fig-standards/blob/master/accepted/PSR-0.md) compatible autoloader for automatic class loading. -Usage ------ + +## Usage + To check for holidays just instantiate the Util class and call the `getHoliday` method. ```php $util = new \Checkdomain\Holiday\Util(); -$holiday = $util->getHoliday('DE', '01.01.2014'); +$holiday = $util->getHoliday('DE', '2014-01-01'); ``` If you just need to know if there is a holiday on your date there is a `isHoliday` method, too. If you need to know all holidays for a specific country you can instantiate one of the included providers yourself and call the `getHolidaysByYear` method. All providers must follow the `ProviderInterface` interface. -Contributing ------------- -Checkdomain/Holiday is open source. If you use this library it would be great to get some support for currently not implemented countries which you are familiar with. Pull requests will be reviewed and merged fast. -To create a new Provider please see the `ProviderInterface` interface. +## Running Tests -Running Tests -------------- Run a `php composer.phar install` command in the base directory to install the `phpunit` dependency. After that you can simply call `vendor/bin/phpunit tests/` to run the test suite. diff --git a/tests/Checkdomain/Holiday/Provider/ATTest.php b/tests/Checkdomain/Holiday/Provider/ATTest.php index 74590da..de2413d 100644 --- a/tests/Checkdomain/Holiday/Provider/ATTest.php +++ b/tests/Checkdomain/Holiday/Provider/ATTest.php @@ -23,32 +23,32 @@ public function setUp() public function dateProvider() { return array( - array('01.01.2013', null, array('name' => 'Neujahr')), - array('06.01.2013', null, array('name' => 'Heilige Drei Könige')), - array('01.04.2013', null, array('name' => 'Ostermontag')), - array('01.05.2013', null, array('name' => 'Staatsfeiertag')), - array('09.05.2013', null, array('name' => 'Christi Himmelfahrt')), - array('20.05.2013', null, array('name' => 'Pfingstmontag')), - array('30.05.2013', null, array('name' => 'Fronleichnam')), - array('15.08.2013', null, array('name' => 'Mariä Himmelfahrt')), - array('26.10.2013', null, array('name' => 'Nationalfeiertag')), - array('01.11.2013', null, array('name' => 'Allerheiligen')), - array('08.12.2013', null, array('name' => 'Mariä Empfängnis')), - array('25.12.2013', null, array('name' => 'Weihnachten')), - array('26.12.2013', null, array('name' => 'Stefanitag')), - array('01.01.2015', null, array('name' => 'Neujahr')), - array('06.01.2015', null, array('name' => 'Heilige Drei Könige')), - array('06.04.2015', null, array('name' => 'Ostermontag')), - array('01.05.2015', null, array('name' => 'Staatsfeiertag')), - array('14.05.2015', null, array('name' => 'Christi Himmelfahrt')), - array('25.05.2015', null, array('name' => 'Pfingstmontag')), - array('04.06.2015', null, array('name' => 'Fronleichnam')), - array('15.08.2015', null, array('name' => 'Mariä Himmelfahrt')), - array('26.10.2015', null, array('name' => 'Nationalfeiertag')), - array('01.11.2015', null, array('name' => 'Allerheiligen')), - array('08.12.2015', null, array('name' => 'Mariä Empfängnis')), - array('25.12.2015', null, array('name' => 'Weihnachten')), - array('26.12.2015', null, array('name' => 'Stefanitag')), + array('2013-01-01', null, array('name' => 'Neujahr')), + array('2013-01-06', null, array('name' => 'Heilige Drei Könige')), + array('2013-04-01', null, array('name' => 'Ostermontag')), + array('2013-05-01', null, array('name' => 'Staatsfeiertag')), + array('2013-05-09', null, array('name' => 'Christi Himmelfahrt')), + array('2013-05-20', null, array('name' => 'Pfingstmontag')), + array('2013-05-30', null, array('name' => 'Fronleichnam')), + array('2013-08-15', null, array('name' => 'Mariä Himmelfahrt')), + array('2013-10-26', null, array('name' => 'Nationalfeiertag')), + array('2013-11-01', null, array('name' => 'Allerheiligen')), + array('2013-12-08', null, array('name' => 'Mariä Empfängnis')), + array('2013-12-25', null, array('name' => 'Weihnachten')), + array('2013-12-26', null, array('name' => 'Stefanitag')), + array('2015-01-01', null, array('name' => 'Neujahr')), + array('2015-01-06', null, array('name' => 'Heilige Drei Könige')), + array('2015-04-06', null, array('name' => 'Ostermontag')), + array('2015-05-01', null, array('name' => 'Staatsfeiertag')), + array('2015-05-14', null, array('name' => 'Christi Himmelfahrt')), + array('2015-05-25', null, array('name' => 'Pfingstmontag')), + array('2015-06-04', null, array('name' => 'Fronleichnam')), + array('2015-08-15', null, array('name' => 'Mariä Himmelfahrt')), + array('2015-10-26', null, array('name' => 'Nationalfeiertag')), + array('2015-11-01', null, array('name' => 'Allerheiligen')), + array('2015-12-08', null, array('name' => 'Mariä Empfängnis')), + array('2015-12-25', null, array('name' => 'Weihnachten')), + array('2015-12-26', null, array('name' => 'Stefanitag')), ); } } diff --git a/tests/Checkdomain/Holiday/Provider/AbstractTest.php b/tests/Checkdomain/Holiday/Provider/AbstractTest.php index 69afa92..8b308ae 100644 --- a/tests/Checkdomain/Holiday/Provider/AbstractTest.php +++ b/tests/Checkdomain/Holiday/Provider/AbstractTest.php @@ -28,7 +28,7 @@ public function testHolidays($date, $state = null, array $expectation = null) $this->assertNull($holiday); } else { $this->assertNotNull($holiday, 'No Holiday found but assumed to find one on ' . $date->format('Y-m-d')); - $this->assertEquals($date->format('d.m.Y'), $holiday->getDate()->format('d.m.Y')); + $this->assertEquals($date->format('Y-m-d'), $holiday->getDate()->format('Y-m-d')); foreach ($expectation as $property => $expectedValue) { $method = 'get' . ucfirst($property); diff --git a/tests/Checkdomain/Holiday/Provider/DETest.php b/tests/Checkdomain/Holiday/Provider/DETest.php index f38ba81..d3fa7d0 100644 --- a/tests/Checkdomain/Holiday/Provider/DETest.php +++ b/tests/Checkdomain/Holiday/Provider/DETest.php @@ -23,14 +23,14 @@ public function setUp() public function dateProvider() { return array( - array('21.03.2013', null, null), - array('01.01.2013', null, array('name' => 'Neujahr')), - array('06.01.2013', DE::STATE_BY, array('name' => 'Heilige Drei Könige')), - array('06.01.2013', DE::STATE_SH, null), - array('19.06.2014', DE::STATE_HE, array('name' => 'Fronleichnam')), - array('19.06.2014', DE::STATE_SH, null), - array('01.11.2014', DE::STATE_BW, array('name' => 'Allerheiligen')), - array('01.11.2014', DE::STATE_SH, null), + array('2013-03-21', null, null), + array('2013-01-01', null, array('name' => 'Neujahr')), + array('2013-01-06', DE::STATE_BY, array('name' => 'Heilige Drei Könige')), + array('2013-01-06', DE::STATE_SH, null), + array('2014-06-19', DE::STATE_HE, array('name' => 'Fronleichnam')), + array('2014-06-19', DE::STATE_SH, null), + array('2014-11-01', DE::STATE_BW, array('name' => 'Allerheiligen')), + array('2014-11-01', DE::STATE_SH, null), ); } } diff --git a/tests/Checkdomain/Holiday/Provider/DKTest.php b/tests/Checkdomain/Holiday/Provider/DKTest.php index ccde643..b999764 100644 --- a/tests/Checkdomain/Holiday/Provider/DKTest.php +++ b/tests/Checkdomain/Holiday/Provider/DKTest.php @@ -23,17 +23,17 @@ public function setUp() public function dateProvider() { return array( - array('01.01.2016', null, array('name' => 'Nytår')), - array('24.03.2016', null, array('name' => 'Skærtorsdag')), - array('25.03.2016', null, array('name' => 'Langfredag')), - array('27.03.2016', null, array('name' => 'Påskedag')), - array('28.03.2016', null, array('name' => '2. Påskedag')), - array('22.04.2016', null, array('name' => 'Store Bededag')), - array('05.05.2016', null, array('name' => 'Kristi Himmelfartsdag')), - array('15.05.2016', null, array('name' => 'Pinsedag')), - array('16.05.2016', null, array('name' => '2. Pinsedag')), - array('25.12.2016', null, array('name' => '1. Juledag')), - array('26.12.2016', null, array('name' => '2. Juledag')), + array('2016-01-01', null, array('name' => 'Nytår')), + array('2016-03-24', null, array('name' => 'Skærtorsdag')), + array('2016-03-25', null, array('name' => 'Langfredag')), + array('2016-03-27', null, array('name' => 'Påskedag')), + array('2016-03-28', null, array('name' => '2. Påskedag')), + array('2016-04-22', null, array('name' => 'Store Bededag')), + array('2016-05-05', null, array('name' => 'Kristi Himmelfartsdag')), + array('2016-05-15', null, array('name' => 'Pinsedag')), + array('2016-05-16', null, array('name' => '2. Pinsedag')), + array('2016-12-25', null, array('name' => '1. Juledag')), + array('2016-12-26', null, array('name' => '2. Juledag')), ); } } diff --git a/tests/Checkdomain/Holiday/Provider/FRTest.php b/tests/Checkdomain/Holiday/Provider/FRTest.php index 2d95f5a..1a7a427 100644 --- a/tests/Checkdomain/Holiday/Provider/FRTest.php +++ b/tests/Checkdomain/Holiday/Provider/FRTest.php @@ -50,18 +50,18 @@ public function testHolidays($date, $state = null, array $expectation = null) public function dateProvider() { return array( - array('21.03.2014', null, null), - array('01.01.2014', null, array('name' => 'Jour de l\'an')), - array('21.04.2014', null, array('name' => 'Lundi de Pâques')), - array('01.05.2014', null, array('name' => 'Fête du Travail')), - array('08.05.2014', null, array('name' => '8 Mai 1945')), - array('29.05.2014', null, array('name' => 'Jeudi de l\'Ascension')), - array('09.06.2014', null, array('name' => 'Lundi de Pentecôte')), - array('14.07.2014', null, array('name' => 'Fête Nationale')), - array('15.08.2014', null, array('name' => 'Assomption')), - array('01.11.2014', null, array('name' => 'La Toussaint')), - array('11.11.2014', null, array('name' => 'Armistice')), - array('25.12.2014', null, array('name' => 'Noël')), + array('2014-03-21', null, null), + array('2014-01-01', null, array('name' => 'Jour de l\'an')), + array('2014-04-21', null, array('name' => 'Lundi de Pâques')), + array('2014-05-01', null, array('name' => 'Fête du Travail')), + array('2014-05-08', null, array('name' => '8 Mai 1945')), + array('2014-05-29', null, array('name' => 'Jeudi de l\'Ascension')), + array('2014-06-09', null, array('name' => 'Lundi de Pentecôte')), + array('2014-07-14', null, array('name' => 'Fête Nationale')), + array('2014-08-15', null, array('name' => 'Assomption')), + array('2014-11-01', null, array('name' => 'La Toussaint')), + array('2014-11-11', null, array('name' => 'Armistice')), + array('2014-12-25', null, array('name' => 'Noël')), ); } } diff --git a/tests/Checkdomain/Holiday/Provider/ITTest.php b/tests/Checkdomain/Holiday/Provider/ITTest.php index d72a52c..921477e 100644 --- a/tests/Checkdomain/Holiday/Provider/ITTest.php +++ b/tests/Checkdomain/Holiday/Provider/ITTest.php @@ -28,20 +28,20 @@ public function setUp() public function dateProvider() { return array( - array('01.01.2010', null, array('name' => 'Capodanno')), + array('2010-01-01', null, array('name' => 'Capodanno')), - array('24.04.2014', null, null), - array('25.04.2014', null, array('name' => 'Liberazione dal nazifascismo (1945)')), - array('01.01.2014', null, array('name' => 'Capodanno')), + array('2014-04-24', null, null), + array('2014-04-25', null, array('name' => 'Liberazione dal nazifascismo (1945)')), + array('2014-01-01', null, array('name' => 'Capodanno')), - array('20.04.2014', null, array('name' => 'Pasqua')), - array('21.04.2014', null, array('name' => 'Lunedì di Pasqua')), + array('2014-04-20', null, array('name' => 'Pasqua')), + array('2014-04-21', null, array('name' => 'Lunedì di Pasqua')), - array('25.12.2016', null, array('name' => 'Natale di Gesù')), - array('26.12.2016', null, array('name' => 'Santo Stefano')), + array('2016-12-25', null, array('name' => 'Natale di Gesù')), + array('2016-12-26', null, array('name' => 'Santo Stefano')), - array('02.06.2016', null, array('name' => 'Festa della Repubblica')), - array('15.08.2016', null, array('name' => 'Assunzione di Maria')), + array('2016-06-02', null, array('name' => 'Festa della Repubblica')), + array('2016-08-15', null, array('name' => 'Assunzione di Maria')), ); } } diff --git a/tests/Checkdomain/Holiday/Provider/NOTest.php b/tests/Checkdomain/Holiday/Provider/NOTest.php index 698bc8f..1f65cfa 100644 --- a/tests/Checkdomain/Holiday/Provider/NOTest.php +++ b/tests/Checkdomain/Holiday/Provider/NOTest.php @@ -29,59 +29,59 @@ public function dateProvider() { return array( #Test holidays in past years - array('21.03.2010', null, null), - array('01.01.2010', null, array('name' => '1. nyttårsdag')), + array('2010-03-21', null, null), + array('2010-01-01', null, array('name' => '1. nyttårsdag')), - array('01.04.2010', null, array('name' => 'Skjærtorsdag')), - array('02.04.2010', null, array('name' => 'Langfredag')), - array('04.04.2010', null, array('name' => '1. påskedag')), - array('05.04.2010', null, array('name' => '2. påskedag')), + array('2010-04-01', null, array('name' => 'Skjærtorsdag')), + array('2010-04-02', null, array('name' => 'Langfredag')), + array('2010-04-04', null, array('name' => '1. påskedag')), + array('2010-04-05', null, array('name' => '2. påskedag')), - array('01.05.2010', null, array('name' => '1. mai')), - array('13.05.2010', null, array('name' => 'Kristi Himmelfartsdag')), - array('17.05.2010', null, array('name' => 'Grunnlovsdagen')), + array('2010-05-01', null, array('name' => '1. mai')), + array('2010-05-13', null, array('name' => 'Kristi Himmelfartsdag')), + array('2010-05-17', null, array('name' => 'Grunnlovsdagen')), - array('24.05.2010', null, array('name' => '2. pinsedag')), + array('2010-05-24', null, array('name' => '2. pinsedag')), - array('25.12.2010', null, array('name' => '1. juledag')), - array('26.12.2010', null, array('name' => '2. juledag')), + array('2010-12-25', null, array('name' => '1. juledag')), + array('2010-12-26', null, array('name' => '2. juledag')), #Test current year, (when writing these tests) - array('21.03.2014', null, null), - array('01.01.2014', null, array('name' => '1. nyttårsdag')), + array('2014-03-21', null, null), + array('2014-01-01', null, array('name' => '1. nyttårsdag')), - array('17.04.2014', null, array('name' => 'Skjærtorsdag')), - array('18.04.2014', null, array('name' => 'Langfredag')), - array('20.04.2014', null, array('name' => '1. påskedag')), - array('21.04.2014', null, array('name' => '2. påskedag')), + array('2014-04-17', null, array('name' => 'Skjærtorsdag')), + array('2014-04-18', null, array('name' => 'Langfredag')), + array('2014-04-20', null, array('name' => '1. påskedag')), + array('2014-04-21', null, array('name' => '2. påskedag')), - array('01.05.2014', null, array('name' => '1. mai')), - array('29.05.2014', null, array('name' => 'Kristi Himmelfartsdag')), - array('17.05.2014', null, array('name' => 'Grunnlovsdagen')), + array('2014-05-01', null, array('name' => '1. mai')), + array('2014-05-29', null, array('name' => 'Kristi Himmelfartsdag')), + array('2014-05-17', null, array('name' => 'Grunnlovsdagen')), - array('09.06.2014', null, array('name' => '2. pinsedag')), + array('2014-06-09', null, array('name' => '2. pinsedag')), - array('25.12.2014', null, array('name' => '1. juledag')), - array('26.12.2014', null, array('name' => '2. juledag')), + array('2014-12-25', null, array('name' => '1. juledag')), + array('2014-12-26', null, array('name' => '2. juledag')), #Test in the future - array('21.03.2016', null, null), - array('01.01.2016', null, array('name' => '1. nyttårsdag')), + array('2016-03-21', null, null), + array('2016-01-01', null, array('name' => '1. nyttårsdag')), - array('24.03.2016', null, array('name' => 'Skjærtorsdag')), - array('25.03.2016', null, array('name' => 'Langfredag')), - array('27.03.2016', null, array('name' => '1. påskedag')), - array('28.03.2016', null, array('name' => '2. påskedag')), + array('2016-03-24', null, array('name' => 'Skjærtorsdag')), + array('2016-03-25', null, array('name' => 'Langfredag')), + array('2016-03-27', null, array('name' => '1. påskedag')), + array('2016-03-28', null, array('name' => '2. påskedag')), - array('01.05.2016', null, array('name' => '1. mai')), - array('05.05.2016', null, array('name' => 'Kristi Himmelfartsdag')), - array('17.05.2016', null, array('name' => 'Grunnlovsdagen')), + array('2016-05-01', null, array('name' => '1. mai')), + array('2016-05-05', null, array('name' => 'Kristi Himmelfartsdag')), + array('2016-05-17', null, array('name' => 'Grunnlovsdagen')), - array('16.05.2016', null, array('name' => '2. pinsedag')), + array('2016-05-16', null, array('name' => '2. pinsedag')), - array('25.12.2016', null, array('name' => '1. juledag')), - array('26.12.2016', null, array('name' => '2. juledag')), + array('2016-12-25', null, array('name' => '1. juledag')), + array('2016-12-26', null, array('name' => '2. juledag')), ); } } diff --git a/tests/Checkdomain/Holiday/Provider/PLTest.php b/tests/Checkdomain/Holiday/Provider/PLTest.php index f472210..1c73546 100644 --- a/tests/Checkdomain/Holiday/Provider/PLTest.php +++ b/tests/Checkdomain/Holiday/Provider/PLTest.php @@ -28,16 +28,16 @@ public function setUp() public function dateProvider() { return array( - array('01.01.2014', null, array('name' => 'Nowy Rok')), - array('27.03.2016', null, array('name' => 'Wielkanoc')), - array('28.03.2016', null, array('name' => 'Poniedziałek Wielkanocny')), - array('25.12.2014', null, array('name' => 'Boże Narodzenie')), - array('11.11.2013', null, array('name' => 'Święto Niepodległości')), - array('04.06.2015', null, array('name' => 'Boże Ciało')), - array('01.11.2018', null, array('name' => 'Wszystkich Świętych')), - array('01.05.2015', null, array('name' => 'Święto Pracy')), - array('26.12.2016', null, array('name' => 'Drugi dzień Bożego Narodzenia')), - array('15.08.2016', null, array('name' => 'Wniebowzięcie Najświętszej Maryi Panny')), + array('2014-01-01', null, array('name' => 'Nowy Rok')), + array('2016-03-27', null, array('name' => 'Wielkanoc')), + array('2016-03-28', null, array('name' => 'Poniedziałek Wielkanocny')), + array('2014-12-25', null, array('name' => 'Boże Narodzenie')), + array('2013-11-11', null, array('name' => 'Święto Niepodległości')), + array('2015-06-04', null, array('name' => 'Boże Ciało')), + array('2018-11-01', null, array('name' => 'Wszystkich Świętych')), + array('2015-05-01', null, array('name' => 'Święto Pracy')), + array('2016-12-26', null, array('name' => 'Drugi dzień Bożego Narodzenia')), + array('2016-08-15', null, array('name' => 'Wniebowzięcie Najświętszej Maryi Panny')), ); } } diff --git a/tests/Checkdomain/Holiday/Provider/PTTest.php b/tests/Checkdomain/Holiday/Provider/PTTest.php index 92b1630..5a2c1b6 100644 --- a/tests/Checkdomain/Holiday/Provider/PTTest.php +++ b/tests/Checkdomain/Holiday/Provider/PTTest.php @@ -27,24 +27,24 @@ public function setUp() public function dateProvider() { return array( - array('01.01.2010', null, array('name' => 'Ano Novo')), + array('2010-01-01', null, array('name' => 'Ano Novo')), - array('26.05.2013', null, null), - array('25.04.2013', null, array('name' => '25 de Abril')), + array('2013-05-26', null, null), + array('2013-04-25', null, array('name' => '25 de Abril')), - array('05.10.2014', null, null), - array('01.05.2014', null, array('name' => 'Dia do Trabalhador')), + array('2014-10-05', null, null), + array('2014-05-01', null, array('name' => 'Dia do Trabalhador')), - array('01.12.2015', null, null), - array('15.08.2015', null, array('name' => 'Assunção de Nossa Senhora')), + array('2015-12-01', null, null), + array('2015-08-15', null, array('name' => 'Assunção de Nossa Senhora')), - array('02.01.2016', null, null), - array('01.11.2016', null, array('name' => 'Dia de Todos os Santos')), - array('25.12.2016', null, array('name' => 'Natal')), + array('2016-01-02', null, null), + array('2016-11-01', null, array('name' => 'Dia de Todos os Santos')), + array('2016-12-25', null, array('name' => 'Natal')), - array('03.09.2017', null, null), - array('01.12.2017', null, array('name' => 'Restauração da Independência')), - array('10.06.2017', null, array('name' => 'Dia de Portugal')), + array('2017-09-03', null, null), + array('2017-12-01', null, array('name' => 'Restauração da Independência')), + array('2017-06-10', null, array('name' => 'Dia de Portugal')), ); } } diff --git a/tests/Checkdomain/Holiday/Provider/SETest.php b/tests/Checkdomain/Holiday/Provider/SETest.php index b238e7f..1d87034 100644 --- a/tests/Checkdomain/Holiday/Provider/SETest.php +++ b/tests/Checkdomain/Holiday/Provider/SETest.php @@ -29,58 +29,58 @@ public function dateProvider() { return array( # Test holidays in past year - array('21.03.2010', null, null), - array('01.01.2010', null, array('name' => 'Nyårsdagen')), - array('05.01.2010', null, array('name' => 'Trettondagsafton')), - array('06.01.2010', null, array('name' => 'Trettondedag jul')), + array('2010-03-21', null, null), + array('2010-01-01', null, array('name' => 'Nyårsdagen')), + array('2010-01-05', null, array('name' => 'Trettondagsafton')), + array('2010-01-06', null, array('name' => 'Trettondedag jul')), - array('01.04.2010', null, array('name' => 'Skärtorsdagen')), - array('02.04.2010', null, array('name' => 'Långfredagen')), - array('03.04.2010', null, array('name' => 'Påskafton')), - array('04.04.2010', null, array('name' => 'Påskdagen')), - array('05.04.2010', null, array('name' => 'Annandag påsk')), + array('2010-04-01', null, array('name' => 'Skärtorsdagen')), + array('2010-04-02', null, array('name' => 'Långfredagen')), + array('2010-04-03', null, array('name' => 'Påskafton')), + array('2010-04-04', null, array('name' => 'Påskdagen')), + array('2010-04-05', null, array('name' => 'Annandag påsk')), - array('30.04.2010', null, array('name' => 'Valborgsmässoafton')), - array('01.05.2010', null, array('name' => 'Första maj')), - array('13.05.2010', null, array('name' => 'Kristi himmelsfärdsdag')), - array('22.05.2010', null, array('name' => 'Pingstafton')), - array('23.05.2010', null, array('name' => 'Pingstdagen')), - array('06.06.2010', null, array('name' => 'Sveriges nationaldag')), - array('25.06.2010', null, array('name' => 'Midsommarafton')), - array('26.06.2010', null, array('name' => 'Midsommardagen')), - array('05.11.2010', null, array('name' => 'Allhelgonaafton')), - array('06.11.2010', null, array('name' => 'Alla helgons dag')), - array('24.12.2010', null, array('name' => 'Julafton')), - array('25.12.2010', null, array('name' => 'Juldagen')), - array('26.12.2010', null, array('name' => 'Annandag jul')), - array('31.12.2010', null, array('name' => 'Nyårsafton')), + array('2010-04-30', null, array('name' => 'Valborgsmässoafton')), + array('2010-05-01', null, array('name' => 'Första maj')), + array('2010-05-13', null, array('name' => 'Kristi himmelsfärdsdag')), + array('2010-05-22', null, array('name' => 'Pingstafton')), + array('2010-05-23', null, array('name' => 'Pingstdagen')), + array('2010-06-06', null, array('name' => 'Sveriges nationaldag')), + array('2010-06-25', null, array('name' => 'Midsommarafton')), + array('2010-06-26', null, array('name' => 'Midsommardagen')), + array('2010-11-05', null, array('name' => 'Allhelgonaafton')), + array('2010-11-06', null, array('name' => 'Alla helgons dag')), + array('2010-12-24', null, array('name' => 'Julafton')), + array('2010-12-25', null, array('name' => 'Juldagen')), + array('2010-12-26', null, array('name' => 'Annandag jul')), + array('2010-12-31', null, array('name' => 'Nyårsafton')), #Test current year, (when writing these tests) - array('21.03.2015', null, null), - array('01.01.2015', null, array('name' => 'Nyårsdagen')), - array('05.01.2015', null, array('name' => 'Trettondagsafton')), - array('06.01.2015', null, array('name' => 'Trettondedag jul')), + array('2015-03-21', null, null), + array('2015-01-01', null, array('name' => 'Nyårsdagen')), + array('2015-01-05', null, array('name' => 'Trettondagsafton')), + array('2015-01-06', null, array('name' => 'Trettondedag jul')), - array('02.04.2015', null, array('name' => 'Skärtorsdagen')), - array('03.04.2015', null, array('name' => 'Långfredagen')), - array('04.04.2015', null, array('name' => 'Påskafton')), - array('05.04.2015', null, array('name' => 'Påskdagen')), - array('06.04.2015', null, array('name' => 'Annandag påsk')), + array('2015-04-02', null, array('name' => 'Skärtorsdagen')), + array('2015-04-03', null, array('name' => 'Långfredagen')), + array('2015-04-04', null, array('name' => 'Påskafton')), + array('2015-04-05', null, array('name' => 'Påskdagen')), + array('2015-04-06', null, array('name' => 'Annandag påsk')), - array('30.04.2015', null, array('name' => 'Valborgsmässoafton')), - array('01.05.2015', null, array('name' => 'Första maj')), - array('14.05.2015', null, array('name' => 'Kristi himmelsfärdsdag')), - array('23.05.2015', null, array('name' => 'Pingstafton')), - array('24.05.2015', null, array('name' => 'Pingstdagen')), - array('06.06.2015', null, array('name' => 'Sveriges nationaldag')), - array('19.06.2015', null, array('name' => 'Midsommarafton')), - array('20.06.2015', null, array('name' => 'Midsommardagen')), - array('30.10.2015', null, array('name' => 'Allhelgonaafton')), - array('31.10.2015', null, array('name' => 'Alla helgons dag')), - array('24.12.2015', null, array('name' => 'Julafton')), - array('25.12.2015', null, array('name' => 'Juldagen')), - array('26.12.2015', null, array('name' => 'Annandag jul')), - array('31.12.2015', null, array('name' => 'Nyårsafton')), + array('2015-04-30', null, array('name' => 'Valborgsmässoafton')), + array('2015-05-01', null, array('name' => 'Första maj')), + array('2015-05-14', null, array('name' => 'Kristi himmelsfärdsdag')), + array('2015-05-23', null, array('name' => 'Pingstafton')), + array('2015-05-24', null, array('name' => 'Pingstdagen')), + array('2015-06-06', null, array('name' => 'Sveriges nationaldag')), + array('2015-06-19', null, array('name' => 'Midsommarafton')), + array('2015-06-20', null, array('name' => 'Midsommardagen')), + array('2015-10-30', null, array('name' => 'Allhelgonaafton')), + array('2015-10-31', null, array('name' => 'Alla helgons dag')), + array('2015-12-24', null, array('name' => 'Julafton')), + array('2015-12-25', null, array('name' => 'Juldagen')), + array('2015-12-26', null, array('name' => 'Annandag jul')), + array('2015-12-31', null, array('name' => 'Nyårsafton')), ); } } diff --git a/tests/Checkdomain/Holiday/UtilTest.php b/tests/Checkdomain/Holiday/UtilTest.php index f6c2fb7..f5fb84c 100644 --- a/tests/Checkdomain/Holiday/UtilTest.php +++ b/tests/Checkdomain/Holiday/UtilTest.php @@ -63,14 +63,14 @@ public function testGetHoliday($iso, $date, array $expectation) public function providerHoliday() { return array( - array('DE', '25.12.2013', array(true, array( + array('DE', '2013-12-25', array(true, array( 'name' => '1. Weihnachtstag' ))), - array('DE', '01.05.2013', array(true, array( + array('DE', '2013-05-01', array(true, array( 'name' => 'Tag der Arbeit' ))), - array('DE', '02.01.2013', array(false, null)), - array('DE', '26.04.2038', array(true, array( + array('DE', '2013-01-02', array(false, null)), + array('DE', '2038-04-26', array(true, array( 'name' => 'Ostermontag' ))) );