@@ -39,31 +39,27 @@ application's tests with the same command as before.
39
39
40
40
PHPUnit is configured by the ``phpunit.xml.dist `` file in the root of your application.
41
41
42
- .. tip ::
43
-
44
- Use the ``--coverage-* `` command options to generate code coverage reports.
45
- Read the PHPUnit manual to learn more about `code coverage analysis `_.
46
-
47
42
Types of Tests
48
43
--------------
49
44
45
+ To get a common language and shared context, it is important to define a what different
46
+ types of tests really mean. Symfony will use the following definition. If you have
47
+ learned something different, that is not necessarily wrong. It is just different
48
+ from what the Symfony documentation is using.
49
+
50
50
`Unit Tests `_
51
51
These tests ensure that *individual * units of source code (e.g. a single
52
52
class) behave as intended.
53
53
54
54
`Integration Tests `_
55
55
These tests test a combination of classes and commonly interact with
56
56
Symfony's service container. These tests do not yet cover the full
57
- working application, those are called *Functional tests *.
57
+ working application, those are called *Application tests *.
58
58
59
- `Functional Tests `_
60
- Functional tests test the behavior of a complete application. They
59
+ `Application Tests `_
60
+ Application tests test the behavior of a complete application. They
61
61
make HTTP requests and test that the response is as expected.
62
62
63
- `End to End Tests (E2E) `_
64
- At last, end to end tests test the application as a real user. They use
65
- a real browser and real integrations with external services.
66
-
67
63
Unit Tests
68
64
----------
69
65
@@ -152,10 +148,10 @@ TODO
152
148
153
149
.. _functional-tests :
154
150
155
- Functional Tests
151
+ Application Tests
156
152
----------------
157
153
158
- Functional tests check the integration of the different layers of an
154
+ Application tests check the integration of the different layers of an
159
155
application (from the routing to the views). They are no different from unit
160
156
tests as far as PHPUnit is concerned, but they have a very specific workflow:
161
157
@@ -175,7 +171,7 @@ tests:
175
171
Set-up your Test Environment
176
172
~~~~~~~~~~~~~~~~~~~~~~~~~~~~
177
173
178
- The Client used by functional tests creates a Kernel that runs in a special
174
+ The Client used by application tests creates a Kernel that runs in a special
179
175
``test `` environment. Since Symfony loads the ``config/packages/test/*.yaml ``
180
176
in the ``test `` environment, you can tweak any of your application's settings
181
177
specifically for testing.
@@ -363,7 +359,7 @@ For more information, read the `DoctrineFixturesBundle documentation`_.
363
359
Write Your First Functional Test
364
360
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
365
361
366
- Functional tests are PHP files that typically live in the ``tests/Controller ``
362
+ Application tests are PHP files that typically live in the ``tests/Controller ``
367
363
directory of your application. If you want to test the pages handled by your
368
364
``PostController `` class, start by creating a new ``PostControllerTest.php ``
369
365
file that extends a special ``WebTestCase `` class.
@@ -389,7 +385,7 @@ As an example, a test could look like this::
389
385
390
386
.. tip ::
391
387
392
- To run your functional tests, the ``WebTestCase `` class needs to know which
388
+ To run your application tests, the ``WebTestCase `` class needs to know which
393
389
is the application kernel to bootstrap it. The kernel class is usually
394
390
defined in the ``KERNEL_CLASS `` environment variable (included in the
395
391
default ``.env.test `` file provided by Symfony):
@@ -482,7 +478,7 @@ returns a ``Crawler`` instance.
482
478
483
479
.. tip ::
484
480
485
- Hardcoding the request URLs is a best practice for functional tests. If the
481
+ Hardcoding the request URLs is a best practice for application tests. If the
486
482
test generates URLs using the Symfony router, it won't detect any change
487
483
made to the application URLs which may impact the end users.
488
484
@@ -698,7 +694,7 @@ You can also override HTTP headers on a per request basis::
698
694
Reporting Exceptions
699
695
....................
700
696
701
- Debugging exceptions in functional tests may be difficult because by default
697
+ Debugging exceptions in application tests may be difficult because by default
702
698
they are caught and you need to look at the logs to see which exception was
703
699
thrown. Disabling catching of exceptions in the test client allows the exception
704
700
to be reported by PHPUnit::
0 commit comments