diff --git a/src/Yasumi/Provider/Germany.php b/src/Yasumi/Provider/Germany.php new file mode 100644 index 000000000..ce4ad4f7d --- /dev/null +++ b/src/Yasumi/Provider/Germany.php @@ -0,0 +1,97 @@ + + */ +namespace Yasumi\Provider; + +use DateTime; +use DateTimeZone; +use Yasumi\Holiday; + +/** + * Provider for all holidays in Germany. + */ +class Germany extends AbstractProvider +{ + use CommonHolidays, ChristianHolidays; + + /** + * Initialize holidays for Germany. + */ + public function initialize() + { + $this->timezone = 'Europe/Berlin'; + + // Add common holidays + $this->addHoliday($this->newYearsDay($this->year, $this->timezone, $this->locale)); + + // Add common Christian holidays (common in Germany) + $this->addHoliday($this->ascensionDay($this->year, $this->timezone, $this->locale)); + $this->addHoliday($this->christmasDay($this->year, $this->timezone, $this->locale)); + $this->addHoliday($this->easterMonday($this->year, $this->timezone, $this->locale)); + $this->addHoliday($this->goodFriday($this->year, $this->timezone, $this->locale)); + $this->addHoliday($this->internationalWorkersDay($this->year, $this->timezone, $this->locale)); + $this->addHoliday($this->newYearsDay($this->year, $this->timezone, $this->locale)); + $this->addHoliday($this->pentecostMonday($this->year, $this->timezone, $this->locale)); + $this->addHoliday($this->secondChristmasDay($this->year, $this->timezone, $this->locale)); + + // Calculate other holidays + $this->calculateGermanUnityDay(); + $this->calculateReformationDay(); + } + + /** + * German Unity Day + * + * The Day of German Unity (German: Tag der Deutschen Einheit) is the national day of Germany, celebrated on + * 3 October as a public holiday. It commemorates the anniversary of German reunification in 1990, when the + * goal of a united Germany that originated in the middle of the 19th century, was fulfilled again. Therefore, + * the name addresses neither the re-union nor the union, but the unity of Germany. The Day of German Unity on + * 3 October has been the German national holiday since 1990, when the reunification was formally completed. It + * is a legal holiday for the Federal Republic of Germany. + * + * @link https://en.wikipedia.org/wiki/German_Unity_Day + */ + public function calculateGermanUnityDay() + { + if ($this->year >= 1990) { + $this->addHoliday(new Holiday('germanUnityDay', ['de_DE' => 'Tag der Deutschen Einheit'], + new DateTime($this->year . '-10-3', new \DateTimeZone($this->timezone)), $this->locale)); + } + } + + /** + * Calculates the day of the reformation. + * + * Reformation Day is a religious holiday celebrated on October 31, alongside All Hallows' Eve, in remembrance + * of the Reformation. It is celebrated among various Protestants, especially by Lutheran and Reformed church + * communities. + + * It is a civic holiday in the German states of Brandenburg, Mecklenburg-Vorpommern, Saxony, Saxony-Anhalt and + * Thuringia. Slovenia celebrates it as well due to the profound contribution of the Reformation to that nation's + * cultural development, although Slovenes are mainly Roman Catholics. With the increasing influence of + * Protestantism in Latin America (particularly newer groups such as various Evangelical Protestants, Pentecostals + * or Charismatics), it has been declared a national holiday in Chile in 2009. + * + * @link https://en.wikipedia.org/wiki/Reformation_Day + */ + public function calculateReformationDay() + { + /** + * @link https://de.wikipedia.org/wiki/Reformationstag#Ursprung_und_Geschichte + */ + if ($this->year == 2017) { + $this->addHoliday(new Holiday('reformationDay', [ + 'de_DE' => 'Reformationstag', + ], new DateTime("$this->year-10-31", new DateTimeZone($this->timezone)), $this->locale)); + } + } +} \ No newline at end of file diff --git a/src/Yasumi/data/translations/allSaintsDay.php b/src/Yasumi/data/translations/allSaintsDay.php index dc6956f11..1edaef4a5 100644 --- a/src/Yasumi/data/translations/allSaintsDay.php +++ b/src/Yasumi/data/translations/allSaintsDay.php @@ -19,5 +19,6 @@ 'fr_FR' => 'La Toussaint', 'es_ES' => 'Día de todos los Santos', 'sv_SE' => 'alla helgons dag', - 'fi_FI' => 'Pyhäinpäivä' + 'fi_FI' => 'Pyhäinpäivä', + 'de_DE' => 'Allerheiligen' ]; \ No newline at end of file diff --git a/src/Yasumi/data/translations/ascensionDay.php b/src/Yasumi/data/translations/ascensionDay.php index a6462ab77..0e797aa34 100644 --- a/src/Yasumi/data/translations/ascensionDay.php +++ b/src/Yasumi/data/translations/ascensionDay.php @@ -19,5 +19,6 @@ 'da_DK' => 'Kristi Himmelfartsdag', 'nb_NO' => 'Kristi himmelfartsdag', 'sv_SE' => 'Kristi himmelsfärds dag', - 'fi_FI' => 'Helatorstai' + 'fi_FI' => 'Helatorstai', + 'de_DE' => 'Christi Himmelfahrt' ]; diff --git a/src/Yasumi/data/translations/assumptionOfMary.php b/src/Yasumi/data/translations/assumptionOfMary.php index 1bcc924b9..33636bdfd 100644 --- a/src/Yasumi/data/translations/assumptionOfMary.php +++ b/src/Yasumi/data/translations/assumptionOfMary.php @@ -17,5 +17,6 @@ 'nl_BE' => 'Onze Lieve Vrouw hemelvaart', 'it_IT' => 'Assunzione di Maria Vergine', 'fr_FR' => 'L\'Assomption de Marie', - 'es_ES' => 'Asunción de la Virgen María' + 'es_ES' => 'Asunción de la Virgen María', + 'de_DE' => 'Mariä Himmelfahrt' ]; \ No newline at end of file diff --git a/src/Yasumi/data/translations/christmasDay.php b/src/Yasumi/data/translations/christmasDay.php index 685810fbf..cbc9582be 100644 --- a/src/Yasumi/data/translations/christmasDay.php +++ b/src/Yasumi/data/translations/christmasDay.php @@ -21,5 +21,6 @@ 'da_DK' => '1. Juledag', 'nb_NO' => 'Første juledag', 'sv_SE' => 'juldagen', - 'fi_FI' => 'Joulupäivä' + 'fi_FI' => 'Joulupäivä', + 'de_DE' => '1. Weihnachtsfeiertag' ]; \ No newline at end of file diff --git a/src/Yasumi/data/translations/corpusChristi.php b/src/Yasumi/data/translations/corpusChristi.php index b8c10529f..0ba44806c 100644 --- a/src/Yasumi/data/translations/corpusChristi.php +++ b/src/Yasumi/data/translations/corpusChristi.php @@ -13,5 +13,6 @@ // Translation for Corpus Christi return [ 'en_US' => 'Corpus Christi', - 'es_ES' => 'Corpus Christi' + 'es_ES' => 'Corpus Christi', + 'de_DE' => 'Fronleichnam' ]; \ No newline at end of file diff --git a/src/Yasumi/data/translations/easterMonday.php b/src/Yasumi/data/translations/easterMonday.php index 7c5c36ec4..38cc9c183 100644 --- a/src/Yasumi/data/translations/easterMonday.php +++ b/src/Yasumi/data/translations/easterMonday.php @@ -21,5 +21,6 @@ 'da_DK' => '2. Påskedag', 'nb_NO' => 'Andre påskedag', 'sv_SE' => 'annandag påsk', - 'fi_FI' => '2. pääsiäispäivä' + 'fi_FI' => '2. pääsiäispäivä', + 'de_DE' => 'Ostermontag' ]; \ No newline at end of file diff --git a/src/Yasumi/data/translations/epiphany.php b/src/Yasumi/data/translations/epiphany.php index 76e19f34f..d918d0f90 100644 --- a/src/Yasumi/data/translations/epiphany.php +++ b/src/Yasumi/data/translations/epiphany.php @@ -20,6 +20,6 @@ 'it_IT' => 'Epifania', 'es_ES' => 'Día de Reyes', 'sv_SE' => 'trettondedag jul', - 'fi_FI' => 'Loppiainen' - + 'fi_FI' => 'Loppiainen', + 'de_DE' => 'Heilige 3 Könige' ]; \ No newline at end of file diff --git a/src/Yasumi/data/translations/goodFriday.php b/src/Yasumi/data/translations/goodFriday.php index 438dde3b7..4e6febb7a 100644 --- a/src/Yasumi/data/translations/goodFriday.php +++ b/src/Yasumi/data/translations/goodFriday.php @@ -22,5 +22,6 @@ 'da_DK' => 'Langfredag', 'nb_NO' => 'Langfredag', 'sv_SE' => 'långfredagen', - 'fi_FI' => 'Pitkäperjantai' + 'fi_FI' => 'Pitkäperjantai', + 'de_DE' => 'Karfreitag' ]; \ No newline at end of file diff --git a/src/Yasumi/data/translations/internationalWorkersDay.php b/src/Yasumi/data/translations/internationalWorkersDay.php index 167f0a369..8c1d7d618 100644 --- a/src/Yasumi/data/translations/internationalWorkersDay.php +++ b/src/Yasumi/data/translations/internationalWorkersDay.php @@ -21,5 +21,6 @@ 'es_ES' => 'Día del Trabajador', 'nb_NO' => 'Arbeidernes dag', 'sv_SE' => 'Första maj', - 'fi_FI' => 'Vappu' + 'fi_FI' => 'Vappu', + 'de_DE' => 'Tag der Arbeit' ]; \ No newline at end of file diff --git a/src/Yasumi/data/translations/newYearsDay.php b/src/Yasumi/data/translations/newYearsDay.php index 3421dc5b2..ebdf9b4d2 100644 --- a/src/Yasumi/data/translations/newYearsDay.php +++ b/src/Yasumi/data/translations/newYearsDay.php @@ -23,5 +23,6 @@ 'da_DK' => 'Nytårsdag', 'nb_NO' => 'Første nyttårsdag', 'sv_SE' => 'nyårsdagen', - 'fi_FI' => 'Uudenvuodenpäivä' -]; + 'fi_FI' => 'Uudenvuodenpäivä', + 'de_DE' => 'Neujahr' +]; \ No newline at end of file diff --git a/src/Yasumi/data/translations/pentecostMonday.php b/src/Yasumi/data/translations/pentecostMonday.php index 89e6efd47..b5dd095e2 100644 --- a/src/Yasumi/data/translations/pentecostMonday.php +++ b/src/Yasumi/data/translations/pentecostMonday.php @@ -17,5 +17,6 @@ 'nl_BE' => 'Pinkstermaandag', 'fr_FR' => 'Lundi de Pentecôte', 'da_DK' => '2. Pinsedag', - 'nb_NO' => 'Andre pinsedag' + 'nb_NO' => 'Andre pinsedag', + 'de_DE' => 'Pfingstmontag' ]; \ No newline at end of file diff --git a/src/Yasumi/data/translations/secondChristmasDay.php b/src/Yasumi/data/translations/secondChristmasDay.php index 61289fa15..b0efb5fdc 100644 --- a/src/Yasumi/data/translations/secondChristmasDay.php +++ b/src/Yasumi/data/translations/secondChristmasDay.php @@ -18,6 +18,6 @@ 'da_DK' => '2. Juledag', 'nb_NO' => 'Andre juledag', 'sv_SE' => 'annandag jul', - 'fi_FI' => '2. joulupäivä' - + 'fi_FI' => '2. joulupäivä', + 'de_DE' => '2. Weihnachtsfeiertag' ]; \ No newline at end of file diff --git a/tests/Germany/AscensionDayTest.php b/tests/Germany/AscensionDayTest.php new file mode 100644 index 000000000..799bbf949 --- /dev/null +++ b/tests/Germany/AscensionDayTest.php @@ -0,0 +1,46 @@ + + */ + +namespace Yasumi\Tests\Germany; + +use DateTime; +use DateTimeZone; + +/** + * Class for testing Ascension Day in Germany. + */ +class AscensionDayTest extends GermanyBaseTestCase +{ + /** + * The name of the holiday to be tested + */ + const HOLIDAY = 'ascensionDay'; + + /** + * Tests Ascension Day. + */ + public function testAscensionDay() + { + $year = 1754; + $this->assertHoliday(self::REGION, 'ascensionDay', $year, + new DateTime("$year-5-23", new DateTimeZone(self::TIMEZONE))); + } + + /** + * Tests the translated name of the holiday defined in this test. + */ + public function testTranslation() + { + $this->assertTranslatedHolidayName(self::REGION, self::HOLIDAY, $this->generateRandomYear(), + [self::LOCALE => 'Christi Himmelfahrt']); + } +} diff --git a/tests/Germany/ChristmasTest.php b/tests/Germany/ChristmasTest.php new file mode 100644 index 000000000..e6028f5b7 --- /dev/null +++ b/tests/Germany/ChristmasTest.php @@ -0,0 +1,58 @@ + + */ + +namespace Yasumi\Tests\Germany; + +use DateTime; + +/** + * Class for testing Christmas in Germany. + */ +class ChristmasTest extends GermanyBaseTestCase +{ + /** + * The name of the holiday + */ + const HOLIDAY = 'christmasDay'; + + /** + * Tests Christmas Day. + * + * @dataProvider ChristmasDayDataProvider + * + * @param int $year the year for which Christmas Day needs to be tested + * @param DateTime $expected the expected date + */ + public function testChristmasDay($year, $expected) + { + $this->assertHoliday(self::REGION, self::HOLIDAY, $year, $expected); + } + + /** + * Returns a list of random test dates used for assertion of Christmas Day. + * + * @return array list of test dates for Christmas Day + */ + public function ChristmasDayDataProvider() + { + return $this->generateRandomDates(12, 25, self::TIMEZONE); + } + + /** + * Tests translated name of Christmas Day. + */ + public function testTranslation() + { + $this->assertTranslatedHolidayName(self::REGION, self::HOLIDAY, $this->generateRandomYear(), + [self::LOCALE => '1. Weihnachtsfeiertag']); + } +} diff --git a/tests/Germany/EasterMondayTest.php b/tests/Germany/EasterMondayTest.php new file mode 100644 index 000000000..2451af746 --- /dev/null +++ b/tests/Germany/EasterMondayTest.php @@ -0,0 +1,46 @@ + + */ + +namespace Yasumi\Tests\Germany; + +use DateTime; +use DateTimeZone; + +/** + * Class containing tests for Easter Monday in Germany. + */ +class EasterMondayTest extends GermanyBaseTestCase +{ + /** + * The name of the holiday to be tested + */ + const HOLIDAY = 'easterMonday'; + + /** + * Tests the holiday defined in this test. + */ + public function testHoliday() + { + $year = 2000; + $this->assertHoliday(self::REGION, self::HOLIDAY, $year, + new DateTime("$year-4-24", new DateTimeZone(self::TIMEZONE))); + } + + /** + * Tests translated name of the holiday defined in this test. + */ + public function testTranslation() + { + $this->assertTranslatedHolidayName(self::REGION, self::HOLIDAY, $this->generateRandomYear(), + [self::LOCALE => 'Ostermontag']); + } +} diff --git a/tests/Germany/GermanUnityDayTest.php b/tests/Germany/GermanUnityDayTest.php new file mode 100644 index 000000000..6b4e016f5 --- /dev/null +++ b/tests/Germany/GermanUnityDayTest.php @@ -0,0 +1,60 @@ + + */ + +namespace Yasumi\Tests\Germany; + +use DateTime; +use DateTimeZone; + +/** + * Class for testing the German Unity Day in Germany. + */ +class GermanUnityDayTest extends GermanyBaseTestCase +{ + /** + * The year in which the holiday was first established + */ + const ESTABLISHMENT_YEAR = 1990; + + /** + * The name of the holiday + */ + const HOLIDAY = 'germanUnityDay'; + + /** + * Tests the holiday defined in this test on or after establishment. + */ + public function testHolidayOnAfterEstablishment() + { + $year = 2022; + $this->assertHoliday(self::REGION, self::HOLIDAY, $year, + new DateTime("$year-10-3", new DateTimeZone(self::TIMEZONE))); + } + + /** + * Tests the holiday defined in this test before establishment. + */ + public function testHolidayBeforeEstablishment() + { + $this->assertNotHoliday(self::REGION, self::HOLIDAY, + $this->generateRandomYear(1000, self::ESTABLISHMENT_YEAR - 1)); + } + + /** + * Tests the translated name of the holiday defined in this test on or after establishment. + */ + public function testTranslationOnAfterEstablishment() + { + $this->assertTranslatedHolidayName(self::REGION, self::HOLIDAY, + $this->generateRandomYear(self::ESTABLISHMENT_YEAR, 2080), [self::LOCALE => 'Tag der Deutschen Einheit']); + } +} diff --git a/tests/Germany/GermanyBaseTestCase.php b/tests/Germany/GermanyBaseTestCase.php new file mode 100644 index 000000000..c9b019707 --- /dev/null +++ b/tests/Germany/GermanyBaseTestCase.php @@ -0,0 +1,39 @@ + + */ + +namespace Yasumi\Tests\Germany; + +use PHPUnit_Framework_TestCase; +use Yasumi\Tests\YasumiBase; + +/** + * Base class for test cases of the Netherlands holiday provider. + */ +abstract class GermanyBaseTestCase extends PHPUnit_Framework_TestCase +{ + use YasumiBase; + + /** + * Name of the region (e.g. country / state) to be tested + */ + const REGION = 'Germany'; + + /** + * Timezone in which this provider has holidays defined + */ + const TIMEZONE = 'Europe/Berlin'; + + /** + * Locale that is considered common for this provider + */ + const LOCALE = 'de_DE'; +} diff --git a/tests/Germany/GermanyTest.php b/tests/Germany/GermanyTest.php new file mode 100644 index 000000000..ef61c7efd --- /dev/null +++ b/tests/Germany/GermanyTest.php @@ -0,0 +1,84 @@ + + */ + +namespace Yasumi\Tests\Germany; + +use Yasumi\Holiday; + +/** + * Class for testing holidays in Germany. + */ +class GermanyTest extends GermanyBaseTestCase +{ + /** + * @var int year random year number used for all tests in this Test Case + */ + protected $year; + + /** + * Tests if all national holidays in Finland are defined by the provider class + */ + public function testNationalHolidays() + { + $this->assertDefinedHolidays([ + 'ascensionDay', + 'christmasDay', + 'easterMonday', + 'germanUnityDay', + 'goodFriday', + 'internationalWorkersDay', + 'newYearsDay', + 'pentecostMonday', + 'secondChristmasDay' + ], self::REGION, $this->year, Holiday::TYPE_NATIONAL); + } + + /** + * Tests if all observed holidays in Germany are defined by the provider class + */ + public function testObservedHolidays() + { + $this->assertDefinedHolidays([], self::REGION, $this->year, Holiday::TYPE_OBSERVANCE); + } + + /** + * Tests if all seasonal holidays in Germany are defined by the provider class + */ + public function testSeasonalHolidays() + { + $this->assertDefinedHolidays([], self::REGION, $this->year, Holiday::TYPE_SEASON); + } + + /** + * Tests if all bank holidays in Germany are defined by the provider class + */ + public function testBankHolidays() + { + $this->assertDefinedHolidays([], self::REGION, $this->year, Holiday::TYPE_BANK); + } + + /** + * Tests if all other holidays in Germany are defined by the provider class + */ + public function testOtherHolidays() + { + $this->assertDefinedHolidays([], self::REGION, $this->year, Holiday::TYPE_OTHER); + } + + /** + * Initial setup of this Test Case + */ + protected function setUp() + { + $this->year = $this->generateRandomYear(1900); + } +} diff --git a/tests/Germany/GoodFridayTest.php b/tests/Germany/GoodFridayTest.php new file mode 100644 index 000000000..182b903ed --- /dev/null +++ b/tests/Germany/GoodFridayTest.php @@ -0,0 +1,46 @@ + + */ + +namespace Yasumi\Tests\Germany; + +use DateTime; +use DateTimeZone; + +/** + * Class for testing Good Friday in Germany. + */ +class GoodFridayTest extends GermanyBaseTestCase +{ + /** + * The name of the holiday to be tested + */ + const HOLIDAY = 'goodFriday'; + + /** + * Tests Good Friday. + */ + public function testGoodFriday() + { + $year = 1876; + $this->assertHoliday(self::REGION, 'goodFriday', $year, + new DateTime("$year-4-14", new DateTimeZone(self::TIMEZONE))); + } + + /** + * Tests translated name of the holiday defined in this test. + */ + public function testTranslation() + { + $this->assertTranslatedHolidayName(self::REGION, self::HOLIDAY, $this->generateRandomYear(), + [self::LOCALE => 'Karfreitag']); + } +} diff --git a/tests/Germany/InternationalWorkersDayTest.php b/tests/Germany/InternationalWorkersDayTest.php new file mode 100644 index 000000000..e333ad3f9 --- /dev/null +++ b/tests/Germany/InternationalWorkersDayTest.php @@ -0,0 +1,58 @@ + + */ + +namespace Yasumi\Tests\Germany; + +use DateTime; + +/** + * Class containing tests for International Workers' Day (i.e. Labour Day) in Germany. + */ +class InternationalWorkersDayTest extends GermanyBaseTestCase +{ + /** + * The name of the holiday + */ + const HOLIDAY = 'internationalWorkersDay'; + + /** + * Tests International Workers' Day. + * + * @dataProvider InternationalWorkersDayDataProvider + * + * @param int $year the year for which International Workers' Day needs to be tested + * @param DateTime $expected the expected date + */ + public function testInternationalWorkersDay($year, $expected) + { + $this->assertHoliday(self::REGION, self::HOLIDAY, $year, $expected); + } + + /** + * Tests translated name of International Workers' Day. + */ + public function testTranslatedInternationalWorkersDay() + { + $this->assertTranslatedHolidayName(self::REGION, self::HOLIDAY, $this->generateRandomYear(), + [self::LOCALE => 'Tag der Arbeit']); + } + + /** + * Returns a list of random test dates used for assertion of International Workers' Day. + * + * @return array list of test dates for International Workers' Day + */ + public function InternationalWorkersDayDataProvider() + { + return $this->generateRandomDates(5, 1, self::TIMEZONE); + } +} diff --git a/tests/Germany/NewYearsDayTest.php b/tests/Germany/NewYearsDayTest.php new file mode 100644 index 000000000..d6804d4f4 --- /dev/null +++ b/tests/Germany/NewYearsDayTest.php @@ -0,0 +1,58 @@ + + */ + +namespace Yasumi\Tests\Germany; + +use DateTime; + +/** + * Class for testing New Years Day in Germany. + */ +class NewYearsDayTest extends GermanyBaseTestCase +{ + /** + * The name of the holiday to be tested + */ + const HOLIDAY = 'newYearsDay'; + + /** + * Tests the holiday defined in this test. + * + * @dataProvider HolidayDataProvider + * + * @param int $year the year for which the holiday defined in this test needs to be tested + * @param DateTime $expected the expected date + */ + public function testHoliday($year, $expected) + { + $this->assertHoliday(self::REGION, self::HOLIDAY, $year, $expected); + } + + /** + * Returns a list of random test dates used for assertion of the holiday defined in this test + * + * @return array list of test dates for the holiday defined in this test + */ + public function HolidayDataProvider() + { + return $this->generateRandomDates(1, 1, self::TIMEZONE); + } + + /** + * Tests the translated name of the holiday defined in this test. + */ + public function testTranslation() + { + $this->assertTranslatedHolidayName(self::REGION, self::HOLIDAY, $this->generateRandomYear(), + [self::LOCALE => 'Neujahr']); + } +} diff --git a/tests/Germany/PentecostMondayTest.php b/tests/Germany/PentecostMondayTest.php new file mode 100644 index 000000000..fef4899ef --- /dev/null +++ b/tests/Germany/PentecostMondayTest.php @@ -0,0 +1,46 @@ + + */ + +namespace Yasumi\Tests\Germany; + +use DateTime; +use DateTimeZone; + +/** + * Class for testing Pentecost Monday in Germany. + */ +class PentecostMondayTest extends GermanyBaseTestCase +{ + /** + * The name of the holiday + */ + const HOLIDAY = 'pentecostMonday'; + + /** + * Tests the holiday defined in this test. + */ + public function testHoliday() + { + $year = 2019; + $this->assertHoliday(self::REGION, self::HOLIDAY, $year, + new DateTime("$year-6-10", new DateTimeZone(self::TIMEZONE))); + } + + /** + * Tests the translated name of the holiday defined in this test. + */ + public function testTranslation() + { + $this->assertTranslatedHolidayName(self::REGION, self::HOLIDAY, $this->generateRandomYear(), + [self::LOCALE => 'Pfingstmontag']); + } +} diff --git a/tests/Germany/SecondChristmasDayTest.php b/tests/Germany/SecondChristmasDayTest.php new file mode 100644 index 000000000..c400730cf --- /dev/null +++ b/tests/Germany/SecondChristmasDayTest.php @@ -0,0 +1,58 @@ + + */ + +namespace Yasumi\Tests\Germany; + +use DateTime; + +/** + * Class for testing the Second Christmas Day in Germany. + */ +class SecondChristmasDayTest extends GermanyBaseTestCase +{ + /** + * The name of the holiday to be tested + */ + const HOLIDAY = 'secondChristmasDay'; + + /** + * Tests the holiday defined in this test. + * + * @dataProvider HolidayDataProvider + * + * @param int $year the year for which the holiday defined in this test needs to be tested + * @param DateTime $expected the expected date + */ + public function testHoliday($year, $expected) + { + $this->assertHoliday(self::REGION, self::HOLIDAY, $year, $expected); + } + + /** + * Returns a list of random test dates used for assertion of the holiday defined in this test + * + * @return array list of test dates for the holiday defined in this test + */ + public function HolidayDataProvider() + { + return $this->generateRandomDates(12, 26, self::TIMEZONE); + } + + /** + * Tests the translated name of the holiday defined in this test. + */ + public function testTranslation() + { + $this->assertTranslatedHolidayName(self::REGION, self::HOLIDAY, $this->generateRandomYear(), + [self::LOCALE => '2. Weihnachtsfeiertag']); + } +}