Skip to content

Commit a00a30f

Browse files
committed
test(japan): exclude 2019 from emperorsBirthday random year range
In 2019, Emperor Akihito abdicated and no Emperor's Birthday holiday was observed that year. The provider correctly returns nothing for 2019, but testTranslation and testHolidayType used an unbounded generateRandomYear(ESTABLISHMENT_YEAR) that could land on 2019, causing intermittent failures. Signed-off-by: Sacha Telgenhof <me@sachatelgenhof.com>
1 parent a91c825 commit a00a30f

1 file changed

Lines changed: 20 additions & 2 deletions

File tree

tests/Japan/EmperorsBirthdayTest.php

Lines changed: 20 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -139,10 +139,19 @@ public function testEmperorsBirthdayIn2019(): void
139139
*/
140140
public function testTranslation(): void
141141
{
142+
// Era 1: 1949–2018 (2019 is excluded — no Emperor's Birthday that year due to abdication)
142143
$this->assertTranslatedHolidayName(
143144
self::REGION,
144145
self::HOLIDAY,
145-
static::generateRandomYear(self::ESTABLISHMENT_YEAR),
146+
static::generateRandomYear(self::ESTABLISHMENT_YEAR, 2018),
147+
[self::LOCALE => '天皇誕生日']
148+
);
149+
150+
// Era 2: 2020+ (Emperor Naruhito's birthday, February 23)
151+
$this->assertTranslatedHolidayName(
152+
self::REGION,
153+
self::HOLIDAY,
154+
static::generateRandomYear(2020),
146155
[self::LOCALE => '天皇誕生日']
147156
);
148157
}
@@ -154,10 +163,19 @@ public function testTranslation(): void
154163
*/
155164
public function testHolidayType(): void
156165
{
166+
// Era 1: 1949–2018 (2019 is excluded — no Emperor's Birthday that year due to abdication)
167+
$this->assertHolidayType(
168+
self::REGION,
169+
self::HOLIDAY,
170+
static::generateRandomYear(self::ESTABLISHMENT_YEAR, 2018),
171+
Holiday::TYPE_OFFICIAL
172+
);
173+
174+
// Era 2: 2020+ (Emperor Naruhito's birthday, February 23)
157175
$this->assertHolidayType(
158176
self::REGION,
159177
self::HOLIDAY,
160-
static::generateRandomYear(self::ESTABLISHMENT_YEAR),
178+
static::generateRandomYear(2020),
161179
Holiday::TYPE_OFFICIAL
162180
);
163181
}

0 commit comments

Comments
 (0)