@@ -59,17 +59,17 @@ more confidence.
5959Deprecations in PHPUnit
6060~~~~~~~~~~~~~~~~~~~~~~~
6161
62- By default, PHPUnit will handle deprecation notices as real errors. This means
63- that all tests are aborted because it uses a BC layer.
62+ When you run your tests using PHPUnit, no deprecation notices are shown.
63+ To help you here, Symfony provides a PHPUnit bridge. This bridge will show
64+ you a nice summary of all deprecation notices at the end of the test report.
6465
65- To make sure this doesn't happen, you can install the PHPUnit bridge:
66+ All you need to do is install the PHPUnit bridge:
6667
6768.. code-block :: bash
6869
6970 $ composer require --dev symfony/phpunit-bridge
7071
71- Now, your tests execute normally and a nice summary of the deprecation notices
72- is displayed at the end of the test report:
72+ Now, you can start fixing the notices:
7373
7474.. code-block :: text
7575
@@ -87,12 +87,36 @@ is displayed at the end of the test report:
8787 2x in PageAdminTest::testPageList from Symfony\Cmf\SimpleCmsBundle\Tests\WebTest\Admin
8888 1x in PageAdminTest::testPageEdit from Symfony\Cmf\SimpleCmsBundle\Tests\WebTest\Admin
8989
90+ Once you fixed them all, the command ends with ``0 `` (success) and you're
91+ done!
92+
93+ .. sidebar :: Using the Weak Deprecations Mode
94+
95+ Sometimes, you can't fix all deprecations (e.g. something was deprecated
96+ in 2.6 and you still need to support 2.3). In these cases, you can still
97+ use the bridge to fix as many deprecations as possible and then switch
98+ to the weak test mode to make your tests pass again. You can do this by
99+ using the ``SYMFONY_DEPRECATIONS_HELPER `` env variable:
100+
101+ .. code-block :: xml
102+
103+ <!-- phpunit.xml.dist -->
104+ <phpunit >
105+ <!-- ... -->
106+
107+ <php >
108+ <env name =" SYMFONY_DEPRECATIONS_HELPER" value =" weak" />
109+ </php >
110+ </phpunit >
111+
112+ (you can also execute the command like ``SYMFONY_DEPRECATIONS_HELPER=weak phpunit ``).
113+
90114.. _upgrade-major-symfony-composer :
91115
921162) Update to the New Major Version via Composer
93117-----------------------------------------------
94118
95- If your code is deprecation free, you can update the Symfony library via
119+ Once your code is deprecation free, you can update the Symfony library via
96120Composer by modifying your ``composer.json `` file:
97121
98122.. code-block :: json
@@ -103,14 +127,14 @@ Composer by modifying your ``composer.json`` file:
103127 "require" : {
104128 "symfony/symfony" : " 3.0.*" ,
105129 },
106- "..." : " ..." ,
130+ "..." : " ..."
107131 }
108132
109133 Next, use Composer to download new versions of the libraries:
110134
111135.. code-block :: bash
112136
113- $ composer update symfony/symfony
137+ $ composer update --with-dependencies symfony/symfony
114138
115139 .. include :: /cookbook/upgrade/_update_dep_errors.rst.inc
116140
0 commit comments