From cd605ceeeced2db81aa56a407a37f65888abd0e3 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?J=C3=A9r=C3=B4me=20Tamarelle?= Date: Tue, 21 Oct 2025 17:40:07 +0200 Subject: [PATCH] Document TEST_GENERATE_FIXTURES for snapshot tests --- contributing/code/tests.rst | 12 ++++++++++++ 1 file changed, 12 insertions(+) diff --git a/contributing/code/tests.rst b/contributing/code/tests.rst index 060e3eda02b..f09a8446ffd 100644 --- a/contributing/code/tests.rst +++ b/contributing/code/tests.rst @@ -64,6 +64,18 @@ what's going on and if the tests are broken because of the new code. On Windows, install the `Cmder`_, `ConEmu`_, `ANSICON`_ or `Mintty`_ free applications to see colored test results. +Testing Generated Code +---------------------- + +Some tests generate code on the fly and check that it matches expected stored in +in a file. To regenerate those files, you can use the following approach, run +the tests with the environment variable ``TEST_GENERATE_FIXTURES`` set to ``1``: + +.. code-block:: terminal + + $ TEST_GENERATE_FIXTURES=1 php ./phpunit src/Symfony/Component/Config/Tests/Builder/GeneratedConfigTest.php + + .. _`install Composer`: https://getcomposer.org/download/ .. _Cmder: https://cmder.app/ .. _ConEmu: https://conemu.github.io/