@@ -5,14 +5,38 @@ Whenever you write a new line of code, you also potentially add new bugs.
55To build better and more reliable applications, you should test your code
66using both functional and unit tests.
77
8- .. _testing-installation :
8+ Symfony integrates with an independent library called `PHPUnit `_ to give you a
9+ rich testing framework. This article covers the PHPUnit basics you'll need to
10+ write Symfony tests. To learn everything about PHPUnit and its features, read
11+ the `official PHPUnit documentation `_.
12+
13+ Types of Tests
14+ --------------
15+
16+ There are many types of automated tests and precise definitions often
17+ differ from project to project. In Symfony, the following definitions are
18+ used. If you have learned something different, that is not necessarily
19+ wrong, just different from what the Symfony documentation is using.
20+
21+ `Unit Tests `_
22+ These tests ensure that *individual * units of source code (e.g. a single
23+ class) behave as intended.
24+
25+ `Integration Tests `_
26+ These tests test a combination of classes and commonly interact with
27+ Symfony's service container. These tests do not yet cover the fully
28+ working application, those are called *Application tests *.
29+
30+ `Application Tests `_
31+ Application tests (also known as functional tests) test the behavior of a
32+ complete application. They make HTTP requests (both real and simulated ones)
33+ and test that the response is as expected.
934
10- The PHPUnit Testing Framework
11- -----------------------------
35+ .. _ testing-installation :
36+ .. _ the-phpunit-testing-framework :
1237
13- Symfony integrates with an independent library called `PHPUnit `_ to give
14- you a rich testing framework. This article won't cover PHPUnit itself,
15- which has its own excellent `documentation `_.
38+ Installation
39+ ------------
1640
1741Before creating your first test, install ``symfony/test-pack ``, which installs
1842some other packages needed for testing (such as ``phpunit/phpunit ``):
@@ -44,28 +68,6 @@ your test into multiple "test suites").
4468 missing, you can try running the recipe again using
4569 ``composer recipes:install phpunit/phpunit --force -v ``.
4670
47- Types of Tests
48- --------------
49-
50- There are many types of automated tests and precise definitions often
51- differ from project to project. In Symfony, the following definitions are
52- used. If you have learned something different, that is not necessarily
53- wrong, just different from what the Symfony documentation is using.
54-
55- `Unit Tests `_
56- These tests ensure that *individual * units of source code (e.g. a single
57- class) behave as intended.
58-
59- `Integration Tests `_
60- These tests test a combination of classes and commonly interact with
61- Symfony's service container. These tests do not yet cover the fully
62- working application, those are called *Application tests *.
63-
64- `Application Tests `_
65- Application tests test the behavior of a complete application. They
66- make HTTP requests (both real and simulated ones) and test that the
67- response is as expected.
68-
6971Unit Tests
7072----------
7173
@@ -1159,7 +1161,7 @@ Learn more
11591161 /components/css_selector
11601162
11611163.. _`PHPUnit` : https://phpunit.de/
1162- .. _`documentation` : https://docs.phpunit.de/
1164+ .. _`official PHPUnit documentation` : https://docs.phpunit.de/
11631165.. _`Writing Tests for PHPUnit` : https://docs.phpunit.de/en/10.5/writing-tests-for-phpunit.html
11641166.. _`PHPUnit documentation` : https://docs.phpunit.de/en/10.5/configuration.html
11651167.. _`unit test` : https://en.wikipedia.org/wiki/Unit_testing
0 commit comments