diff --git a/src/Dev/SapphireTest.php b/src/Dev/SapphireTest.php index ab70eab6944..7790f565991 100644 --- a/src/Dev/SapphireTest.php +++ b/src/Dev/SapphireTest.php @@ -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)) {