From b9cd51ae0be693175a0ad06dfa7e31cfdeab04ea Mon Sep 17 00:00:00 2001 From: Javier Eguiluz Date: Fri, 15 Dec 2017 16:36:23 +0100 Subject: [PATCH 1/3] Recommend to use PHPUnitBridge instead of PHPUnit --- setup/bundles.rst | 3 ++- setup/upgrade_major.rst | 3 ++- testing.rst | 21 +++++++++------------ 3 files changed, 13 insertions(+), 14 deletions(-) diff --git a/setup/bundles.rst b/setup/bundles.rst index ba346ecc7fe..1badb4b63e8 100644 --- a/setup/bundles.rst +++ b/setup/bundles.rst @@ -69,7 +69,8 @@ PHPUnit test report: .. code-block:: terminal - $ phpunit + # this command is available after running "composer require phpunit" + $ ./bin/phpunit # ... PHPUnit output diff --git a/setup/upgrade_major.rst b/setup/upgrade_major.rst index 14bbceef458..a5f78d53725 100644 --- a/setup/upgrade_major.rst +++ b/setup/upgrade_major.rst @@ -75,7 +75,8 @@ Now, you can start fixing the notices: .. code-block:: text - $ phpunit + # this command is available after running "composer require phpunit" + $ ./bin/phpunit ... OK (10 tests, 20 assertions) diff --git a/testing.rst b/testing.rst index 4e47c7dd0e6..0cf79eda83e 100644 --- a/testing.rst +++ b/testing.rst @@ -15,10 +15,11 @@ Symfony integrates with an independent library - called PHPUnit - to give you a rich testing framework. This article won't cover PHPUnit itself, but it has its own excellent `documentation`_. -.. note:: +First, install PHPUnit support in your Symfony application running this command: + +.. code-block:: terminal - It's recommended to use the latest stable PHPUnit version, `installed as - PHAR`_. + $ composer require phpunit Each test - whether it's a unit test or a functional test - is a PHP class that should live in the ``tests/`` directory of your application. If you follow @@ -27,7 +28,7 @@ command: .. code-block:: terminal - $ phpunit + $ ./bin/phpunit PHPUnit is configured by the ``phpunit.xml.dist`` file in the root of your Symfony application. @@ -99,16 +100,13 @@ Running tests for a given file or directory is also very easy: .. code-block:: terminal # run all tests of the application - $ phpunit + $ ./bin/phpunit - # run all tests in the Util directory - $ phpunit tests/Util + # run all tests in the Util/ directory + $ ./bin/phpunit tests/Util # run tests for the Calculator class - $ phpunit tests/Util/CalculatorTest.php - - # run all tests for the entire Bundle - $ phpunit tests/ + $ ./bin/phpunit tests/Util/CalculatorTest.php .. index:: single: Tests; Functional tests @@ -920,4 +918,3 @@ Learn more .. _`$_SERVER`: http://php.net/manual/en/reserved.variables.server.php .. _`documentation`: https://phpunit.de/manual/current/en/ -.. _`installed as PHAR`: https://phpunit.de/manual/current/en/installation.html#installation.phar From 383d5884300d293b59af300c12365cc85b40bae8 Mon Sep 17 00:00:00 2001 From: Javier Eguiluz Date: Tue, 2 Jan 2018 13:34:28 +0100 Subject: [PATCH 2/3] Show the full "symfony/phpunit-bridge" package name when installing it with Composer --- setup/bundles.rst | 2 +- setup/upgrade_major.rst | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/setup/bundles.rst b/setup/bundles.rst index 1badb4b63e8..11739a65982 100644 --- a/setup/bundles.rst +++ b/setup/bundles.rst @@ -69,7 +69,7 @@ PHPUnit test report: .. code-block:: terminal - # this command is available after running "composer require phpunit" + # this command is available after running "composer require symfony/phpunit-bridge" $ ./bin/phpunit # ... PHPUnit output diff --git a/setup/upgrade_major.rst b/setup/upgrade_major.rst index a5f78d53725..0a186616ca6 100644 --- a/setup/upgrade_major.rst +++ b/setup/upgrade_major.rst @@ -75,7 +75,7 @@ Now, you can start fixing the notices: .. code-block:: text - # this command is available after running "composer require phpunit" + # this command is available after running "composer require symfony/phpunit-bridge" $ ./bin/phpunit ... From f66004fec7ffb33f36946bed41c10a25207c9138 Mon Sep 17 00:00:00 2001 From: Javier Eguiluz Date: Tue, 2 Jan 2018 13:35:54 +0100 Subject: [PATCH 3/3] Install PHPUnit Bridge only in --dev --- setup/bundles.rst | 2 +- setup/upgrade_major.rst | 2 +- testing.rst | 2 +- 3 files changed, 3 insertions(+), 3 deletions(-) diff --git a/setup/bundles.rst b/setup/bundles.rst index 11739a65982..a0af605d446 100644 --- a/setup/bundles.rst +++ b/setup/bundles.rst @@ -69,7 +69,7 @@ PHPUnit test report: .. code-block:: terminal - # this command is available after running "composer require symfony/phpunit-bridge" + # this command is available after running "composer require --dev symfony/phpunit-bridge" $ ./bin/phpunit # ... PHPUnit output diff --git a/setup/upgrade_major.rst b/setup/upgrade_major.rst index 0a186616ca6..5e04ac2038f 100644 --- a/setup/upgrade_major.rst +++ b/setup/upgrade_major.rst @@ -75,7 +75,7 @@ Now, you can start fixing the notices: .. code-block:: text - # this command is available after running "composer require symfony/phpunit-bridge" + # this command is available after running "composer require --dev symfony/phpunit-bridge" $ ./bin/phpunit ... diff --git a/testing.rst b/testing.rst index 0cf79eda83e..4ae7061a592 100644 --- a/testing.rst +++ b/testing.rst @@ -19,7 +19,7 @@ First, install PHPUnit support in your Symfony application running this command: .. code-block:: terminal - $ composer require phpunit + $ composer require --dev phpunit Each test - whether it's a unit test or a functional test - is a PHP class that should live in the ``tests/`` directory of your application. If you follow