|
| 1 | +<?php |
| 2 | + |
| 3 | +declare(strict_types = 1); |
| 4 | + |
| 5 | +/** |
| 6 | + * This file is part of the 'Yasumi' package. |
| 7 | + * |
| 8 | + * The easy PHP Library for calculating holidays. |
| 9 | + * |
| 10 | + * Copyright (c) 2015 - 2024 AzuyaLabs |
| 11 | + * |
| 12 | + * For the full copyright and license information, please view the LICENSE |
| 13 | + * file that was distributed with this source code. |
| 14 | + * |
| 15 | + * @author Sacha Telgenhof <me at sachatelgenhof dot com> |
| 16 | + */ |
| 17 | + |
| 18 | +namespace Yasumi\tests\Germany\Bavaria; |
| 19 | + |
| 20 | +use Yasumi\Holiday; |
| 21 | +use Yasumi\tests\HolidayTestCase; |
| 22 | + |
| 23 | +/** |
| 24 | + * Class for testing the day of the Assumption of Mary in Bavaria (Germany). |
| 25 | + */ |
| 26 | +class AssumptionOfMaryTest extends BavariaBaseTestCase implements HolidayTestCase |
| 27 | +{ |
| 28 | + /** |
| 29 | + * The name of the holiday. |
| 30 | + */ |
| 31 | + public const HOLIDAY = 'assumptionOfMary'; |
| 32 | + |
| 33 | + /** |
| 34 | + * Tests the holiday defined in this test. |
| 35 | + * |
| 36 | + * @dataProvider HolidayDataProvider |
| 37 | + * |
| 38 | + * @param int $year the year for which the holiday defined in this test needs to be tested |
| 39 | + * @param \DateTime $expected the expected date |
| 40 | + */ |
| 41 | + public function testHoliday(int $year, \DateTimeInterface $expected): void |
| 42 | + { |
| 43 | + $this->assertHoliday(self::REGION, self::HOLIDAY, $year, $expected); |
| 44 | + } |
| 45 | + |
| 46 | + /** |
| 47 | + * Returns a list of random test dates used for assertion of the holiday defined in this test. |
| 48 | + * |
| 49 | + * @return array<array> list of test dates for the holiday defined in this test |
| 50 | + * |
| 51 | + * @throws \Exception |
| 52 | + */ |
| 53 | + public function HolidayDataProvider(): array |
| 54 | + { |
| 55 | + return $this->generateRandomDates(8, 15, self::TIMEZONE); |
| 56 | + } |
| 57 | + |
| 58 | + /** |
| 59 | + * Tests translated name of the Assumption of Mary. |
| 60 | + * |
| 61 | + * @throws \Exception |
| 62 | + */ |
| 63 | + public function testTranslation(): void |
| 64 | + { |
| 65 | + $this->assertTranslatedHolidayName( |
| 66 | + self::REGION, |
| 67 | + self::HOLIDAY, |
| 68 | + $this->generateRandomYear(), |
| 69 | + [self::LOCALE => 'Mariä Himmelfahrt'] |
| 70 | + ); |
| 71 | + } |
| 72 | + |
| 73 | + /** |
| 74 | + * Tests type of the holiday defined in this test. |
| 75 | + * |
| 76 | + * @throws \Exception |
| 77 | + */ |
| 78 | + public function testHolidayType(): void |
| 79 | + { |
| 80 | + $this->assertHolidayType(self::REGION, self::HOLIDAY, $this->generateRandomYear(), Holiday::TYPE_OTHER); |
| 81 | + } |
| 82 | +} |
0 commit comments