Movatterモバイル変換


[0]ホーム

URL:


Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

[PHPUnitBridge] Allow setting the locale usingSYMFONY_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 ourterms of service andprivacy statement. We’ll occasionally send you account related emails.

Already on GitHub?Sign in to your account

Merged
Merged
Changes fromall commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
39 changes: 37 additions & 2 deletionscomponents/phpunit_bridge.rst
View file
Open in desktop
Original file line numberDiff line numberDiff line change
Expand Up@@ -7,8 +7,8 @@ The PHPUnit Bridge

It comes with the following features:

*Forces the tests to usea consistent locale (``C``) (if you create
locale-sensitive tests, use PHPUnit's ``setLocale()`` method);
*Sets by defaulta consistent locale (``C``)for your tests(if you
createlocale-sensitive tests, use PHPUnit's ``setLocale()`` method);

* Auto-register ``class_exists`` to load Doctrine annotations (when used);

Expand DownExpand Up@@ -402,6 +402,41 @@ Log Deprecations
For turning the verbose output off and write it to a log file instead you can use
``SYMFONY_DEPRECATIONS_HELPER='logFile=/path/deprecations.log'``.

Setting The Locale For Tests
~~~~~~~~~~~~~~~~~~~~~~~~~~~~

By default, the PHPUnit Bridge forces the locale to ``C`` to avoid locale
issues in tests. This behavior can be changed by setting the
``SYMFONY_PHPUNIT_LOCALE`` environment variable to the desired locale:

.. code-block:: bash

# .env.test
SYMFONY_PHPUNIT_LOCALE="fr_FR"

Alternatively, you can set this environment variable in the PHPUnit
configuration file:

.. code-block:: xml

<!-- https://phpunit.de/manual/6.0/en/appendixes.configuration.html -->
<phpunit xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:noNamespaceSchemaLocation="https://schema.phpunit.de/6.0/phpunit.xsd"
>

<!-- ... -->

<php>
<!-- ... -->
<env name="SYMFONY_PHPUNIT_LOCALE" value="fr_FR"/>
</php>
</phpunit>

.. versionadded:: 6.4

The support for the ``SYMFONY_PHPUNIT_LOCALE`` environment variable was
introduced in Symfony 6.4.

.. _write-assertions-about-deprecations:

Write Assertions about Deprecations
Expand Down

[8]ページ先頭

©2009-2025 Movatter.jp