mirror of
https://github.com/symfony/symfony-docs.git
synced 2026-03-24 00:32:14 +01:00
Updates related to the main PHPUnit configuration file
This commit is contained in:
@@ -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
|
||||
----------------------
|
||||
|
||||
@@ -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
|
||||
|
||||
|
||||
@@ -114,7 +114,7 @@ done!
|
||||
|
||||
.. code-block:: xml
|
||||
|
||||
<!-- phpunit.xml.dist -->
|
||||
<!-- phpunit.dist.xml -->
|
||||
<phpunit>
|
||||
<!-- ... -->
|
||||
|
||||
|
||||
16
testing.rst
16
testing.rst
@@ -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``.
|
||||
|
||||
@@ -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:
|
||||
|
||||
@@ -391,7 +391,7 @@ Now, enable it as a PHPUnit extension:
|
||||
|
||||
.. code-block:: xml
|
||||
|
||||
<!-- phpunit.xml.dist -->
|
||||
<!-- phpunit.dist.xml -->
|
||||
<phpunit>
|
||||
<!-- ... -->
|
||||
|
||||
|
||||
@@ -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"
|
||||
|
||||
@@ -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>
|
||||
|
||||
Reference in New Issue
Block a user