-
-
Notifications
You must be signed in to change notification settings - Fork 156
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Adds UK bank holiday for Queen Elizabeth II’s funeral (#287)
Adds bank holiday for Queen Elizabeth II’s funeral
- Loading branch information
1 parent
42dd9a5
commit 156f0dc
Showing
3 changed files
with
140 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
111 changes: 111 additions & 0 deletions
111
tests/UnitedKingdom/QueenElizabethFuneralBankHolidayTest.php
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,111 @@ | ||
<?php | ||
|
||
declare(strict_types=1); | ||
/* | ||
* This file is part of the Yasumi package. | ||
* | ||
* Copyright (c) 2015 - 2022 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\UnitedKingdom; | ||
|
||
use DateTime; | ||
use DateTimeZone; | ||
use Exception; | ||
use Yasumi\Holiday; | ||
use Yasumi\tests\HolidayTestCase; | ||
|
||
/** | ||
* Class for testing the Queen Elizabeth's Funeral Bank Holiday in the United Kingdom. | ||
*/ | ||
class QueenElizabethFuneralBankHolidayTest extends UnitedKingdomBaseTestCase implements HolidayTestCase | ||
{ | ||
/** | ||
* The name of the holiday. | ||
*/ | ||
public const HOLIDAY = 'queenElizabethFuneralBankHoliday'; | ||
|
||
/** | ||
* The year in which the holiday occurred. | ||
*/ | ||
public const ACTIVE_YEAR = 2022; | ||
|
||
/** | ||
* The date on which the holiday occurred. | ||
*/ | ||
public const ACTIVE_DATE = '2022-9-19'; | ||
|
||
/** | ||
* Tests the holiday defined in this test. | ||
* | ||
* @throws Exception | ||
*/ | ||
public function testHoliday(): void | ||
{ | ||
$this->assertHoliday( | ||
self::REGION, | ||
self::HOLIDAY, | ||
self::ACTIVE_YEAR, | ||
new DateTime(self::ACTIVE_DATE, new DateTimeZone(self::TIMEZONE)) | ||
); | ||
} | ||
|
||
/** | ||
* Tests the holiday defined in this test before the year in which it occurred. | ||
* | ||
* @throws Exception | ||
*/ | ||
public function testHolidayBeforeActive(): void | ||
{ | ||
$this->assertNotHoliday( | ||
self::REGION, | ||
self::HOLIDAY, | ||
$this->generateRandomYear(1000, self::ACTIVE_YEAR - 1) | ||
); | ||
} | ||
|
||
/** | ||
* Tests the holiday defined in this test after the year in which it occurred. | ||
* | ||
* @throws Exception | ||
*/ | ||
public function testHolidayAfterActive(): void | ||
{ | ||
$this->assertNotHoliday( | ||
self::REGION, | ||
self::HOLIDAY, | ||
$this->generateRandomYear(self::ACTIVE_YEAR + 1) | ||
); | ||
} | ||
|
||
/** | ||
* Tests the translated name of the holiday defined in this test. | ||
*/ | ||
public function testTranslation(): void | ||
{ | ||
$this->assertTranslatedHolidayName( | ||
self::REGION, | ||
self::HOLIDAY, | ||
self::ACTIVE_YEAR, | ||
[self::LOCALE => 'Queen Elizabeth II’s State Funeral Bank Holiday'] | ||
); | ||
} | ||
|
||
/** | ||
* Tests type of the holiday defined in this test. | ||
*/ | ||
public function testHolidayType(): void | ||
{ | ||
$this->assertHolidayType( | ||
self::REGION, | ||
self::HOLIDAY, | ||
self::ACTIVE_YEAR, | ||
Holiday::TYPE_BANK | ||
); | ||
} | ||
} |