Skip to content

Commit c2fdb08

Browse files
Fix #19: [DE] 500th anniversay of the Reformation
1 parent 5c136b8 commit c2fdb08

File tree

3 files changed

+22
-8
lines changed

3 files changed

+22
-8
lines changed

lib/Checkdomain/Holiday/Provider/AbstractProvider.php

+1-1
Original file line numberDiff line numberDiff line change
@@ -23,7 +23,7 @@ public function getHolidayByDate(\DateTime $date, $state = null)
2323
{
2424
$day = $date->format(self::DATE_FORMAT);
2525

26-
$holidays = $this->getHolidaysByYear($date->format('Y'));
26+
$holidays = $this->getHolidaysByYear(intval($date->format('Y')));
2727

2828
if (isset($holidays[$day])) {
2929
$holiday = $this->createModelFromData($holidays[$day], $date);

lib/Checkdomain/Holiday/Provider/DE.php

+15-7
Original file line numberDiff line numberDiff line change
@@ -37,6 +37,20 @@ public function getHolidaysByYear($year)
3737
{
3838
$easter = $this->getEasterDates($year);
3939

40+
// 500th anniversay of the Reformation
41+
// @see https://de.wikipedia.org/wiki/Reformationstag#Deutschland
42+
if (2017 === $year) {
43+
$reformationDayStates = null;
44+
} else {
45+
$reformationDayStates = array(
46+
self::STATE_BB,
47+
self::STATE_MV,
48+
self::STATE_SN,
49+
self::STATE_ST,
50+
self::STATE_TH,
51+
);
52+
}
53+
4054
$holidays = array(
4155
// Fixed dates
4256
'01-01' => $this->createData('Neujahr'),
@@ -51,13 +65,7 @@ public function getHolidaysByYear($year)
5165
self::STATE_BY,
5266
self::STATE_ST,
5367
)),
54-
'10-31' => $this->createData('Reformationstag', array(
55-
self::STATE_BB,
56-
self::STATE_MV,
57-
self::STATE_SN,
58-
self::STATE_ST,
59-
self::STATE_TH,
60-
)),
68+
'10-31' => $this->createData('Reformationstag', $reformationDayStates),
6169
'11-01' => $this->createData('Allerheiligen', array(
6270
self::STATE_BW,
6371
self::STATE_BY,

tests/Checkdomain/Holiday/Provider/DETest.php

+6
Original file line numberDiff line numberDiff line change
@@ -31,6 +31,12 @@ public function dateProvider()
3131
array('2014-06-19', DE::STATE_SH, null),
3232
array('2014-11-01', DE::STATE_BW, array('name' => 'Allerheiligen')),
3333
array('2014-11-01', DE::STATE_SH, null),
34+
array('2016-10-31', DE::STATE_SH, null),
35+
array('2016-10-31', DE::STATE_BB, array('name' => 'Reformationstag')),
36+
array('2017-10-31', DE::STATE_SH, array('name' => 'Reformationstag')),
37+
array('2017-10-31', DE::STATE_BB, array('name' => 'Reformationstag')),
38+
array('2018-10-31', DE::STATE_SH, null),
39+
array('2018-10-31', DE::STATE_BB, array('name' => 'Reformationstag')),
3440
);
3541
}
3642
}

0 commit comments

Comments
 (0)