Skip to content

Commit

Permalink
Avoid silent exceptions by throwing a new one from the previous excep…
Browse files Browse the repository at this point in the history
…tion.

Signed-off-by: Sacha Telgenhof <[email protected]>
  • Loading branch information
stelgenhof committed Dec 4, 2023
1 parent d8a136b commit 151a477
Show file tree
Hide file tree
Showing 2 changed files with 13 additions and 8 deletions.
3 changes: 3 additions & 0 deletions tests/Portugal/PortugueseRepublicDayTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -76,6 +76,7 @@ public function testHolidayBeforeEstablishment(): void
$this->assertNotHoliday(self::REGION, self::HOLIDAY, $year);
}
} catch (\Exception $e) {
throw new \RuntimeException($e->getMessage(), $e->getCode(), $e);
}
}

Expand All @@ -91,6 +92,7 @@ public function testTranslation(): void
);
}
} catch (\Exception $e) {
throw new \RuntimeException($e->getMessage(), $e->getCode(), $e);
}
}

Expand All @@ -106,6 +108,7 @@ public function testHolidayType(): void
);
}
} catch (\Exception $e) {
throw new \RuntimeException($e->getMessage(), $e->getCode(), $e);
}
}

Expand Down
18 changes: 10 additions & 8 deletions tests/USA/VeteransDayTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -105,12 +105,13 @@ public function testVeteransDayNameBefore1954(): void
{
try {
$year = $this->generateRandomYear(self::ESTABLISHMENT_YEAR, 1953);

$holidays = Yasumi::create(self::REGION, $year);
$holiday = $holidays->getHoliday(self::HOLIDAY);
self::assertEquals('Armistice Day', $holiday->getName());
} catch (\Exception $e) {
throw new \RuntimeException($e->getMessage(), $e->getCode(), $e);
}

$holidays = Yasumi::create(self::REGION, $year);
$holiday = $holidays->getHoliday(self::HOLIDAY);
self::assertEquals('Armistice Day', $holiday->getName());
}

/**
Expand All @@ -122,12 +123,13 @@ public function testVeteransDayNameAfter1954(): void
{
try {
$year = $this->generateRandomYear(1954);

$holidays = Yasumi::create(self::REGION, $year);
$holiday = $holidays->getHoliday(self::HOLIDAY);
self::assertEquals('Veterans Day', $holiday->getName());
} catch (\Exception $e) {
throw new \RuntimeException($e->getMessage(), $e->getCode(), $e);
}

$holidays = Yasumi::create(self::REGION, $year);
$holiday = $holidays->getHoliday(self::HOLIDAY);
self::assertEquals('Veterans Day', $holiday->getName());
}

/**
Expand Down

0 comments on commit 151a477

Please sign in to comment.