Skip to content

[Testing] Updates related to the main PHPUnit configuration file #21272

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

Open
wants to merge 1 commit into
base: 6.4
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all 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
2 changes: 1 addition & 1 deletion bundles/best_practices.rst
Original file line number Diff line number Diff line change
Expand Up @@ -188,7 +188,7 @@ the ``tests/`` directory. Tests should follow the following principles:
.. note::

A test suite must not contain ``AllTests.php`` scripts, but must rely on the
existence of a ``phpunit.xml.dist`` file.
existence of a ``phpunit.dist.xml`` file.

Continuous Integration
----------------------
Expand Down
2 changes: 1 addition & 1 deletion create_framework/unit_testing.rst
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ using `PHPUnit`_. At first, install PHPUnit as a development dependency:

$ composer require --dev phpunit/phpunit:^10.0

Then, create a PHPUnit configuration file in ``example.com/phpunit.xml.dist``:
Then, create a PHPUnit configuration file in ``example.com/phpunit.dist.xml``:

.. code-block:: xml

Expand Down
2 changes: 1 addition & 1 deletion setup/upgrade_major.rst
Original file line number Diff line number Diff line change
Expand Up @@ -114,7 +114,7 @@ done!

.. code-block:: xml

<!-- phpunit.xml.dist -->
<!-- phpunit.dist.xml -->
<phpunit>
<!-- ... -->

Expand Down
16 changes: 8 additions & 8 deletions testing.rst
Original file line number Diff line number Diff line change
Expand Up @@ -55,16 +55,16 @@ This command automatically runs your application tests. Each test is a
PHP class ending with "Test" (e.g. ``BlogControllerTest``) that lives in
the ``tests/`` directory of your application.

PHPUnit is configured by the ``phpunit.xml.dist`` file in the root of your
application. The default configuration provided by Symfony Flex will be
enough in most cases. Read the `PHPUnit documentation`_ to discover all
possible configuration options (e.g. to enable code coverage or to split
your test into multiple "test suites").
PHPUnit is configured by the ``phpunit.dist.xml`` file in the root of your
application (in PHPUnit versions older than 10, the file is named ``phpunit.xml.dist``).
The default configuration provided by Symfony Flex will be enough in most cases.
Read the `PHPUnit documentation`_ to discover all possible configuration options
(e.g. to enable code coverage or to split your test into multiple "test suites").

.. note::

:ref:`Symfony Flex <symfony-flex>` automatically creates
``phpunit.xml.dist`` and ``tests/bootstrap.php``. If these files are
``phpunit.dist.xml`` and ``tests/bootstrap.php``. If these files are
missing, you can try running the recipe again using
``composer recipes:install phpunit/phpunit --force -v``.

Expand All @@ -81,7 +81,7 @@ By convention, the ``tests/`` directory should replicate the directory
of your application for unit tests. So, if you're testing a class in the
``src/Form/`` directory, put the test in the ``tests/Form/`` directory.
Autoloading is automatically enabled via the ``vendor/autoload.php`` file
(as configured by default in the ``phpunit.xml.dist`` file).
(as configured by default in the ``phpunit.dist.xml`` file).

You can run tests using the ``bin/phpunit`` command:

Expand Down Expand Up @@ -391,7 +391,7 @@ Now, enable it as a PHPUnit extension:

.. code-block:: xml

<!-- phpunit.xml.dist -->
<!-- phpunit.dist.xml -->
<phpunit>
<!-- ... -->

Expand Down
4 changes: 2 additions & 2 deletions testing/bootstrap.rst
Original file line number Diff line number Diff line change
Expand Up @@ -35,11 +35,11 @@ You can modify this file to add custom logic:
.. note::

If you don't use Symfony Flex, make sure this file is configured as
bootstrap file in your ``phpunit.xml.dist`` file:
bootstrap file in your ``phpunit.dist.xml`` file:

.. code-block:: xml

<!-- phpunit.xml.dist -->
<!-- phpunit.dist.xml -->
<?xml version="1.0" encoding="UTF-8" ?>
<phpunit
bootstrap="tests/bootstrap.php"
Expand Down
4 changes: 2 additions & 2 deletions testing/end_to_end.rst
Original file line number Diff line number Diff line change
Expand Up @@ -872,12 +872,12 @@ Another option is to create a file called ``tests/router.php`` and add the follo

require $script;

Then declare it as a router for Panther server in ``phpunit.xml.dist`` using the
Then declare it as a router for Panther server in ``phpunit.dist.xml`` using the
``PANTHER_WEB_SERVER_ROUTER`` environment variable:

.. code-block:: xml

<!-- phpunit.xml.dist -->
<!-- phpunit.dist.xml -->
<phpunit>
<!-- ... -->
<php>
Expand Down