Skip to content

Commit

Permalink
feature #52193 [PhpUnitBridge] Allow setting the locale using SYMFONY…
Browse files Browse the repository at this point in the history
…_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
  • Loading branch information
nicolas-grekas committed Oct 27, 2023
2 parents ada57ff + 17e9372 commit 0470bb7
Show file tree
Hide file tree
Showing 3 changed files with 7 additions and 3 deletions.
5 changes: 5 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,6 +1,11 @@
CHANGELOG
=========

6.4
---

* Allow setting the locale using `SYMFONY_PHPUNIT_LOCALE` env var

6.3
---

Expand Down
2 changes: 2 additions & 0 deletions Legacy/SymfonyTestsListenerTrait.php
Original file line number Diff line number Diff line change
Expand Up @@ -50,6 +50,8 @@ class SymfonyTestsListenerTrait
*/
public function __construct(array $mockedNamespaces = [])
{
setlocale(\LC_ALL, $_ENV['SYMFONY_PHPUNIT_LOCALE'] ?? 'C');

if (class_exists(ExcludeList::class)) {
(new ExcludeList())->getExcludedDirectories();
ExcludeList::addDirectory(\dirname((new \ReflectionClass(__CLASS__))->getFileName(), 2));
Expand Down
3 changes: 0 additions & 3 deletions bootstrap.php
Original file line number Diff line number Diff line change
Expand Up @@ -29,9 +29,6 @@
unset($GLOBALS['__composer_autoload_files'][$fileIdentifier]);
}

// Enforce a consistent locale
setlocale(\LC_ALL, 'C');

if (class_exists(Deprecation::class)) {
Deprecation::withoutDeduplication();

Expand Down

0 comments on commit 0470bb7

Please sign in to comment.