@@ -5,14 +5,38 @@ Whenever you write a new line of code, you also potentially add new bugs.
5
5
To build better and more reliable applications, you should test your code
6
6
using both functional and unit tests.
7
7
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.
9
34
10
- The PHPUnit Testing Framework
11
- -----------------------------
35
+ .. _ testing-installation :
36
+ .. _ the-phpunit-testing-framework :
12
37
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
+ ------------
16
40
17
41
Before creating your first test, install ``symfony/test-pack ``, which installs
18
42
some other packages needed for testing (such as ``phpunit/phpunit ``):
@@ -44,28 +68,6 @@ your test into multiple "test suites").
44
68
missing, you can try running the recipe again using
45
69
``composer recipes:install phpunit/phpunit --force -v ``.
46
70
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
-
69
71
Unit Tests
70
72
----------
71
73
@@ -1159,7 +1161,7 @@ Learn more
1159
1161
/components/css_selector
1160
1162
1161
1163
.. _`PHPUnit` : https://phpunit.de/
1162
- .. _`documentation` : https://docs.phpunit.de/
1164
+ .. _`official PHPUnit documentation` : https://docs.phpunit.de/
1163
1165
.. _`Writing Tests for PHPUnit` : https://docs.phpunit.de/en/10.5/writing-tests-for-phpunit.html
1164
1166
.. _`PHPUnit documentation` : https://docs.phpunit.de/en/10.5/configuration.html
1165
1167
.. _`unit test` : https://en.wikipedia.org/wiki/Unit_testing
0 commit comments