@@ -15,10 +15,11 @@ Symfony integrates with an independent library - called PHPUnit - to give
1515you a rich testing framework. This article won't cover PHPUnit itself, but
1616it has its own excellent `documentation `_.
1717
18- .. note ::
18+ First, install PHPUnit support in your Symfony application running this command:
19+
20+ .. code-block :: terminal
1921
20- It's recommended to use the latest stable PHPUnit version, `installed as
21- PHAR `_.
22+ $ composer require --dev phpunit
2223
2324 Each test - whether it's a unit test or a functional test - is a PHP class
2425that should live in the ``tests/ `` directory of your application. If you follow
@@ -27,7 +28,7 @@ command:
2728
2829.. code-block :: terminal
2930
30- $ phpunit
31+ $ ./bin/ phpunit
3132
3233 PHPUnit is configured by the ``phpunit.xml.dist `` file in the root of your
3334Symfony application.
@@ -99,16 +100,13 @@ Running tests for a given file or directory is also very easy:
99100.. code-block :: terminal
100101
101102 # run all tests of the application
102- $ phpunit
103+ $ ./bin/ phpunit
103104
104- # run all tests in the Util directory
105- $ phpunit tests/Util
105+ # run all tests in the Util/ directory
106+ $ ./bin/ phpunit tests/Util
106107
107108 # run tests for the Calculator class
108- $ phpunit tests/Util/CalculatorTest.php
109-
110- # run all tests for the entire Bundle
111- $ phpunit tests/
109+ $ ./bin/phpunit tests/Util/CalculatorTest.php
112110
113111 .. index ::
114112 single: Tests; Functional tests
@@ -920,4 +918,3 @@ Learn more
920918
921919.. _`$_SERVER` : http://php.net/manual/en/reserved.variables.server.php
922920.. _`documentation` : https://phpunit.de/manual/current/en/
923- .. _`installed as PHAR` : https://phpunit.de/manual/current/en/installation.html#installation.phar
0 commit comments