@@ -11,14 +11,16 @@ using both functional and unit tests.
1111The PHPUnit Testing Framework
1212-----------------------------
1313
14- Symfony integrates with an independent library - called PHPUnit - to give
15- you a rich testing framework. This article won't cover PHPUnit itself, but
16- it has its own excellent `documentation `_.
14+ Symfony integrates with an independent library called ` PHPUnit `_ to give you a
15+ rich testing framework. This article won't cover PHPUnit itself, which has its
16+ own excellent `documentation `_.
1717
18- .. note ::
18+ Before creating your first test, install the `PHPUnit Bridge component `_, which
19+ wraps the original PHPUnit binary to provide additional features:
20+
21+ .. code-block :: terminal
1922
20- It's recommended to use the latest stable PHPUnit version, `installed as
21- PHAR `_.
23+ $ composer require --dev symfony/phpunit-bridge
2224
2325 Each test - whether it's a unit test or a functional test - is a PHP class
2426that should live in the ``Tests/ `` subdirectory of your bundles. If you follow
@@ -27,11 +29,10 @@ command:
2729
2830.. code-block :: terminal
2931
30- # specify the configuration directory on the command line
31- $ phpunit -c app/
32+ # the -c option specifies the directory where PHPUnit config is stored
33+ $ ./vendor/bin/simple- phpunit -c app/
3234
33- The ``-c `` option tells PHPUnit to look in the ``app/ `` directory for a configuration
34- file. If you're curious about the PHPUnit options, check out the ``app/phpunit.xml.dist ``
35+ If you're curious about the PHPUnit options, check out the ``app/phpunit.xml.dist ``
3536file.
3637
3738.. tip ::
@@ -101,16 +102,16 @@ Running tests for a given file or directory is also very easy:
101102.. code-block :: terminal
102103
103104 # run all tests of the application
104- $ phpunit -c app
105+ $ ./vendor/bin/simple- phpunit -c app
105106
106107 # run all tests in the Util directory
107- $ phpunit -c app src/AppBundle/Tests/Util
108+ $ ./vendor/bin/simple- phpunit -c app src/AppBundle/Tests/Util
108109
109110 # run tests for the Calculator class
110- $ phpunit -c app src/AppBundle/Tests/Util/CalculatorTest.php
111+ $ ./vendor/bin/simple- phpunit -c app src/AppBundle/Tests/Util/CalculatorTest.php
111112
112113 # run all tests for the entire Bundle
113- $ phpunit -c app src/AppBundle/
114+ $ ./vendor/bin/simple- phpunit -c app src/AppBundle/
114115
115116 .. index ::
116117 single: Tests; Functional tests
@@ -924,6 +925,7 @@ Learn more
924925* :doc: `/components/dom_crawler `
925926* :doc: `/components/css_selector `
926927
927- .. _`$_SERVER ` : http ://php.net/manual/en/reserved.variables.server.php
928+ .. _`PHPUnit ` : https ://phpunit.de/
928929.. _`documentation` : https://phpunit.de/manual/current/en/
929- .. _`installed as PHAR` : https://phpunit.de/manual/current/en/installation.html#installation.phar
930+ .. _`PHPUnit Bridge component` : https://symfony.com/components/PHPUnit%20Bridge
931+ .. _`$_SERVER` : http://php.net/manual/en/reserved.variables.server.php
0 commit comments