Skip to content

Commit

Permalink
feat: add Assumption of Mary holiday to Bavaria (Germany)
Browse files Browse the repository at this point in the history
Signed-off-by: Sacha Telgenhof <me@sachatelgenhof.com>
  • Loading branch information
stelgenhof committed Oct 21, 2024
1 parent f0e40de commit af346fb
Show file tree
Hide file tree
Showing 2 changed files with 83 additions and 0 deletions.
1 change: 1 addition & 0 deletions src/Yasumi/Provider/Germany/Bavaria.php
Original file line number Diff line number Diff line change
Expand Up @@ -50,5 +50,6 @@ public function initialize(): void
$this->addHoliday($this->epiphany($this->year, $this->timezone, $this->locale));
$this->addHoliday($this->corpusChristi($this->year, $this->timezone, $this->locale, Holiday::TYPE_OFFICIAL));
$this->addHoliday($this->allSaintsDay($this->year, $this->timezone, $this->locale));
$this->addHoliday($this->assumptionOfMary($this->year, $this->timezone, $this->locale, Holiday::TYPE_OTHER));
}
}
82 changes: 82 additions & 0 deletions tests/Germany/Bavaria/AssumptionOfMaryTest.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,82 @@
<?php

declare(strict_types = 1);

/**
* This file is part of the 'Yasumi' package.
*
* The easy PHP Library for calculating holidays.
*
* Copyright (c) 2015 - 2024 AzuyaLabs
*
* For the full copyright and license information, please view the LICENSE
* file that was distributed with this source code.
*
* @author Sacha Telgenhof <me at sachatelgenhof dot com>
*/

namespace Yasumi\tests\Germany\Bavaria;

use Yasumi\Holiday;
use Yasumi\tests\HolidayTestCase;

/**
* Class for testing the day of the Assumption of Mary in Bavaria (Germany).
*/
class AssumptionOfMaryTest extends BavariaBaseTestCase implements HolidayTestCase
{
/**
* The name of the holiday.
*/
public const HOLIDAY = 'assumptionOfMary';

/**
* 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(int $year, \DateTimeInterface $expected): void
{
$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<array> list of test dates for the holiday defined in this test
*
* @throws \Exception
*/
public function HolidayDataProvider(): array
{
return $this->generateRandomDates(8, 15, self::TIMEZONE);
}

/**
* Tests translated name of the Assumption of Mary.
*
* @throws \Exception
*/
public function testTranslation(): void
{
$this->assertTranslatedHolidayName(
self::REGION,
self::HOLIDAY,
$this->generateRandomYear(),
[self::LOCALE => 'Mariä Himmelfahrt']
);
}

/**
* Tests type of the holiday defined in this test.
*
* @throws \Exception
*/
public function testHolidayType(): void
{
$this->assertHolidayType(self::REGION, self::HOLIDAY, $this->generateRandomYear(), Holiday::TYPE_OTHER);
}
}

0 comments on commit af346fb

Please sign in to comment.