Skip to content

Commit 8644ada

Browse files
[PhpUnitBridge] Allow setting the locale using SYMFONY_PHPUNIT_LOCALE env var
1 parent 978031e commit 8644ada

File tree

1 file changed

+35
-0
lines changed

1 file changed

+35
-0
lines changed

components/phpunit_bridge.rst

Lines changed: 35 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -402,6 +402,41 @@ Log Deprecations
402402
For turning the verbose output off and write it to a log file instead you can use
403403
``SYMFONY_DEPRECATIONS_HELPER='logFile=/path/deprecations.log'``.
404404

405+
Setting The Locale For Tests
406+
~~~~~~~~~~~~~~~~~~~~~~~~~~~~
407+
408+
By default, the PHPUnit Bridge forces the locale to ``C`` to avoid locale
409+
issues in tests. This behavior can be changed by setting the
410+
``SYMFONY_PHPUNIT_LOCALE`` environment variable to the desired locale:
411+
412+
.. code-block:: bash
413+
414+
# .env.test
415+
SYMFONY_PHPUNIT_LOCALE="fr_FR"
416+
417+
Alternatively, you can set this environment variable in the PHPUnit
418+
configuration file:
419+
420+
.. code-block:: xml
421+
422+
<!-- https://phpunit.de/manual/6.0/en/appendixes.configuration.html -->
423+
<phpunit xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
424+
xsi:noNamespaceSchemaLocation="https://schema.phpunit.de/6.0/phpunit.xsd"
425+
>
426+
427+
<!-- ... -->
428+
429+
<php>
430+
<!-- ... -->
431+
<env name="SYMFONY_PHPUNIT_LOCALE" value="fr_FR"/>
432+
</php>
433+
</phpunit>
434+
435+
.. versionadded:: 6.4
436+
437+
The support for the ``SYMFONY_PHPUNIT_LOCALE`` environment variable was
438+
introduced in Symfony 6.4.
439+
405440
.. _write-assertions-about-deprecations:
406441

407442
Write Assertions about Deprecations

0 commit comments

Comments
 (0)