Skip to content

Commit 0470bb7

Browse files
feature #52193 [PhpUnitBridge] Allow setting the locale using SYMFONY_PHPUNIT_LOCALE env var (VincentLanglet)
This PR was squashed before being merged into the 6.4 branch. Discussion ---------- [PhpUnitBridge] Allow setting the locale using SYMFONY_PHPUNIT_LOCALE env var | Q | A | ------------- | --- | Branch? | 6.4 | Bug fix? | yes | New feature? | yes | Deprecations? | no <!-- please update UPGRADE-*.md and src/**/CHANGELOG.md files --> | Tickets | Fix #52185 | License | MIT cc `@nicolas`-grekas Commits ------- 2954468de1 [PhpUnitBridge] Allow setting the locale using SYMFONY_PHPUNIT_LOCALE env var
2 parents ada57ff + 17e9372 commit 0470bb7

File tree

3 files changed

+7
-3
lines changed

3 files changed

+7
-3
lines changed

Diff for: CHANGELOG.md

+5
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,11 @@
11
CHANGELOG
22
=========
33

4+
6.4
5+
---
6+
7+
* Allow setting the locale using `SYMFONY_PHPUNIT_LOCALE` env var
8+
49
6.3
510
---
611

Diff for: Legacy/SymfonyTestsListenerTrait.php

+2
Original file line numberDiff line numberDiff line change
@@ -50,6 +50,8 @@ class SymfonyTestsListenerTrait
5050
*/
5151
public function __construct(array $mockedNamespaces = [])
5252
{
53+
setlocale(\LC_ALL, $_ENV['SYMFONY_PHPUNIT_LOCALE'] ?? 'C');
54+
5355
if (class_exists(ExcludeList::class)) {
5456
(new ExcludeList())->getExcludedDirectories();
5557
ExcludeList::addDirectory(\dirname((new \ReflectionClass(__CLASS__))->getFileName(), 2));

Diff for: bootstrap.php

-3
Original file line numberDiff line numberDiff line change
@@ -29,9 +29,6 @@
2929
unset($GLOBALS['__composer_autoload_files'][$fileIdentifier]);
3030
}
3131

32-
// Enforce a consistent locale
33-
setlocale(\LC_ALL, 'C');
34-
3532
if (class_exists(Deprecation::class)) {
3633
Deprecation::withoutDeduplication();
3734

0 commit comments

Comments
 (0)