Skip to content

[PHPUnitBridge] Allow setting the locale using SYMFONY_PHPUNIT_LOCALE env var #19089

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 1 commit into from
Oct 27, 2023

Conversation

alexandre-daubois
Copy link
Member

Fix #19088

@carsonbot carsonbot added this to the 6.4 milestone Oct 27, 2023
@carsonbot carsonbot changed the title [PhpUnitBridge] Allow setting the locale using SYMFONY_PHPUNIT_LOCALE env var [PHPUnitBridge] Allow setting the locale using SYMFONY_PHPUNIT_LOCALE env var Oct 27, 2023
@OskarStark
Copy link
Contributor

Thank you Alexandre.

@OskarStark OskarStark merged commit 89e63a1 into symfony:6.4 Oct 27, 2023
@VincentLanglet
Copy link
Contributor

Would it be worth adding that

<env name="SYMFONY_PHPUNIT_LOCALE" value="0"/>

disable the behavior, since

setlocale(\LC_ALL, 0);

returns the locale instead of setting it

@alexandre-daubois
Copy link
Member Author

I'm not sure, because this is something that touches the internals of the bridge, which we do not document. Also, if someone wants to disable this new behavior, it'll remove the env var I guess. So I'm not sure this is something we should add as it may bring more confusion than anything else 🤔

@VincentLanglet
Copy link
Contributor

Also, if someone wants to disable this new behavior, it'll remove the env var I guess.

No, removing the env var won't disable the behavior, it will set the default ?? 'C' locale which doesn't solve my issue symfony/symfony#52185

By default the bridge set a consistent locale and there was no way to avoid this behavior.
The suggestion was to introduce a env var to disable the behavior:
symfony/symfony#52185 (comment)

Then, we added the feature to select another local.
But personally the reason I introduce this was to disable the feature.

When looking at the bridge issues, some people were complaining about the fact a locale was set, but none complained about the locale set. So this feature might be used more often to disable the behavior rather than changing the locale.

OskarStark added a commit that referenced this pull request Oct 30, 2023
… by the bridge (alexandre-daubois)

This PR was merged into the 6.4 branch.

Discussion
----------

[PHPUnitBridge] Add a note to disable the locale forcing by the bridge

Following #19089 (comment), cc `@VincentLanglet` 🙂

Commits
-------

226b0ed [PHPUnitBridge] Add a note to disable the locale forcing by the bridge
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

[PhpUnitBridge] Allow setting the locale using SYMFONY_PHPUNIT_LOCALE e…
4 participants