Skip to content

Commit e5add29

Browse files
committed
minor symfony#5564 Improve and simplify the contributing instructions about tests (javiereguiluz)
This PR was squashed before being merged into the 2.3 branch (closes symfony#5564). Discussion ---------- Improve and simplify the contributing instructions about tests | Q | A | ------------- | --- | Doc fix? | yes | New docs? | no | Applies to | all | Fixed tickets | - Commits ------- 5a942f8 Improve and simplify the contributing instructions about tests
2 parents e43c927 + 5a942f8 commit e5add29

File tree

1 file changed

+22
-67
lines changed

1 file changed

+22
-67
lines changed

contributing/code/tests.rst

Lines changed: 22 additions & 67 deletions
Original file line numberDiff line numberDiff line change
@@ -3,54 +3,32 @@
33
Running Symfony Tests
44
=====================
55

6-
Before submitting a :doc:`patch <patches>` for inclusion, you need to run the
7-
Symfony test suite to check that you have not broken anything.
6+
The Symfony project uses a third-party service which automatically runs tests
7+
for any submitted :doc:`patch <patches>`. If the new code breaks any test,
8+
the pull request will show an error message with a link to the full error details.
89

9-
PHPUnit
10-
-------
10+
In any case, it's a good practice to run tests locally before submitting a
11+
:doc:`patch <patches>` for inclusion, to check that you have not broken anything.
1112

12-
To run the Symfony test suite, `install PHPUnit`_ 4.2 (or later) first.
13+
.. _phpunit:
14+
.. _dependencies_optional:
1315

14-
Dependencies (optional)
15-
-----------------------
16+
Before Running the Tests
17+
------------------------
1618

17-
To run the entire test suite, including tests that depend on external
18-
dependencies, Symfony needs to be able to autoload them. By default, they are
19-
autoloaded from ``vendor/`` under the main root directory (see
20-
``autoload.php.dist``).
21-
22-
The test suite needs the following third-party libraries:
23-
24-
* Doctrine
25-
* Swift Mailer
26-
* Twig
27-
* Monolog
28-
29-
To install them all, use `Composer`_:
30-
31-
Step 1: :doc:`Install Composer globally </cookbook/composer>`
32-
33-
Step 2: Install vendors.
19+
To run the Symfony test suite, `install PHPUnit`_ 4.2 (or later) first. Then,
20+
install the external dependencies used during the tests, such as Doctrine, Twig
21+
and Monolog. To do so, :doc:`install Composer </cookbook/composer>` and execute
22+
the following:
3423

3524
.. code-block:: bash
3625
3726
$ composer install
3827
39-
.. note::
40-
41-
Note that the script takes some time to finish.
28+
.. _running:
4229

43-
After installation, you can update the vendors to their latest version with
44-
the follow command:
45-
46-
.. code-block:: bash
47-
48-
$ composer update
49-
50-
Running
51-
-------
52-
53-
First, update the vendors (see above).
30+
Running the Tests
31+
-----------------
5432

5533
Then, run the test suite from the Symfony root directory with the following
5634
command:
@@ -59,40 +37,17 @@ command:
5937
6038
$ phpunit
6139
62-
The output should display ``OK``. If not, you need to figure out what's going on
63-
and if the tests are broken because of your modifications.
40+
The output should display ``OK``. If not, read the reported errors to figure out
41+
what's going on and if the tests are broken because of the new code.
6442

6543
.. tip::
6644

67-
If you want to test a single component type its path after the ``phpunit``
68-
command, e.g.:
45+
The entire Symfony suite can take up to several minutes to complete. If you
46+
want to test a single component, type its path after the ``phpunit`` command,
47+
e.g.:
6948

7049
.. code-block:: bash
7150
7251
$ phpunit src/Symfony/Component/Finder/
7352
74-
.. tip::
75-
76-
Run the test suite before applying your modifications to check that they
77-
run fine on your configuration.
78-
79-
Code Coverage
80-
-------------
81-
82-
If you add a new feature, you also need to check the code coverage by using
83-
the ``coverage-html`` option:
84-
85-
.. code-block:: bash
86-
87-
$ phpunit --coverage-html=cov/
88-
89-
Check the code coverage by opening the generated ``cov/index.html`` page in a
90-
browser.
91-
92-
.. tip::
93-
94-
The code coverage only works if you have Xdebug enabled and all
95-
dependencies installed.
96-
97-
.. _install PHPUnit: https://phpunit.de/manual/current/en/installation.html
98-
.. _`Composer`: https://getcomposer.org/
53+
.. _`install PHPUnit`: https://phpunit.de/manual/current/en/installation.html

0 commit comments

Comments
 (0)