Skip to content

Commit

Permalink
MNT Handle LogicExceptions when calling setI18nLocale()
Browse files Browse the repository at this point in the history
  • Loading branch information
emteknetnz committed Jan 24, 2025
1 parent 1ea87f8 commit 5ad5cb4
Showing 1 changed file with 9 additions and 0 deletions.
9 changes: 9 additions & 0 deletions src/Dev/SapphireTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -1239,6 +1239,15 @@ protected function mockSleep(int $seconds): DBDatetime
*/
private function setI18nLocale(): void
{
// Skip setting the locale for excluded test classes that are known to cause a
// exception when calling getCurrentRelativePath(), and we can be sure
// do not require the locale to be set to en_US
$excluded = [
'SilverStripe\BehatExtension\Tests\SilverStripeContextTest',
];
if (in_array(static::class, $excluded)) {
return;
}
$path = $this->getCurrentRelativePath();
$packagistName = '';
if (preg_match('#(^|/)vendor/([^/]+/[^/]+)/.+#', $path, $matches)) {
Expand Down

0 comments on commit 5ad5cb4

Please sign in to comment.