From 0975ae7e874631f1d00f93e8040159df58915b52 Mon Sep 17 00:00:00 2001 From: Patrick Kalweit Date: Thu, 28 May 2020 13:26:38 +0200 Subject: [PATCH 1/3] add pentecost to Germany.php --- src/Yasumi/Provider/Germany.php | 1 + 1 file changed, 1 insertion(+) diff --git a/src/Yasumi/Provider/Germany.php b/src/Yasumi/Provider/Germany.php index a96d9bd3d..61c7ee8f4 100644 --- a/src/Yasumi/Provider/Germany.php +++ b/src/Yasumi/Provider/Germany.php @@ -52,6 +52,7 @@ public function initialize(): void $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->pentecost($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)); From 48f1f00e46a2190cb29adf9b2db017d2df31126d Mon Sep 17 00:00:00 2001 From: Patrick Kalweit Date: Thu, 28 May 2020 13:26:53 +0200 Subject: [PATCH 2/3] add test for pentecost in Germany --- tests/Germany/PentecostTest.php | 75 +++++++++++++++++++++++++++++++++ 1 file changed, 75 insertions(+) create mode 100644 tests/Germany/PentecostTest.php diff --git a/tests/Germany/PentecostTest.php b/tests/Germany/PentecostTest.php new file mode 100644 index 000000000..5d3aa6482 --- /dev/null +++ b/tests/Germany/PentecostTest.php @@ -0,0 +1,75 @@ + + */ + +namespace Yasumi\tests\Germany; + +use DateTime; +use DateTimeZone; +use Exception; +use ReflectionException; +use Yasumi\Holiday; +use Yasumi\tests\YasumiTestCaseInterface; + +/** + * Class for testing Pentecost in Germany. + */ +class PentecostTest extends GermanyBaseTestCase implements YasumiTestCaseInterface +{ + /** + * The name of the holiday + */ + public const HOLIDAY = 'pentecost'; + + /** + * Tests the holiday defined in this test. + * @throws Exception + * @throws ReflectionException + */ + public function testHoliday() + { + $year = $this->generateRandomYear(); + $time_stamp = \strtotime( + $year . '-03-21' . \easter_days($year) . ' day + 49 day' + ); + $date = \date('Y-m-d', $time_stamp); + + $this->assertHoliday( + self::REGION, + self::HOLIDAY, + $year, + new DateTime($date, new DateTimeZone(self::TIMEZONE)) + ); + } + + /** + * Tests the translated name of the holiday defined in this test. + * @throws ReflectionException + */ + public function testTranslation(): void + { + $this->assertTranslatedHolidayName( + self::REGION, + self::HOLIDAY, + $this->generateRandomYear(), + [self::LOCALE => 'Pfingstsonntag'] + ); + } + + /** + * Tests type of the holiday defined in this test. + * @throws ReflectionException + */ + public function testHolidayType(): void + { + $this->assertHolidayType(self::REGION, self::HOLIDAY, $this->generateRandomYear(), Holiday::TYPE_OFFICIAL); + } +} From 58ce18aa2a75aea536b66b179b6b53df1d4bcebc Mon Sep 17 00:00:00 2001 From: Patrick Kalweit Date: Mon, 8 Jun 2020 18:11:09 +0200 Subject: [PATCH 3/3] add entry to CHANGELOG.md --- CHANGELOG.md | 1 + 1 file changed, 1 insertion(+) diff --git a/CHANGELOG.md b/CHANGELOG.md index 315c2909d..f4c144520 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -6,6 +6,7 @@ The format is based on [Keep a Changelog](https://keepachangelog.com/) and this ## [Unreleased] ### Added +- Added Pentecost (Sunday) to Germany [\#225](https://github.com/azuyalabs/yasumi/pull/225) - Added Canada Provider [\#215](https://github.com/azuyalabs/yasumi/pull/215) ([lux](https://github.com/lux)) - Added Luxembourg Provider [\#205](https://github.com/azuyalabs/yasumi/pull/205) ([Arkounay](https://github.com/Arkounay)) - Catholic Christmas Day is a new official holiday since 2017 in the Ukraine. [\#202](https://github.com/azuyalabs/yasumi/pull/202)