Skip to content

Commit 14a041a

Browse files
committed
Fix Major upgrade article for 2.7.1 changes
1 parent 31e613a commit 14a041a

File tree

1 file changed

+34
-8
lines changed

1 file changed

+34
-8
lines changed

cookbook/upgrade/major_version.rst

Lines changed: 34 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -45,17 +45,19 @@ in your browser, these notices are shown in the web dev toolbar:
4545
Deprecations in PHPUnit
4646
~~~~~~~~~~~~~~~~~~~~~~~
4747

48-
By default, PHPUnit will handle deprecation notices as real errors. This means
49-
that all tests are aborted because it uses a BC layer.
48+
By default, deprecations that are triggered by Symfony are silenced. This means
49+
that, unless you use Xdebug or a custom error handler, your tests will still
50+
pass without a problem.
5051

51-
To make sure this doesn't happen, you can install the PHPUnit bridge:
52+
If you want to make sure you don't use any deprecated features, you can install
53+
the Symfony PHPunit bridge:
5254

5355
.. code-block:: bash
5456
5557
$ composer require symfony/phpunit-bridge
5658
57-
Now, your tests execute normally and a nice summary of the deprecation notices
58-
is displayed at the end of the test report:
59+
This bridge registers a custom error handler that will report a nice summary of
60+
the deprecation notices at the end of the tests:
5961

6062
.. code-block:: text
6163
@@ -73,12 +75,36 @@ is displayed at the end of the test report:
7375
2x in PageAdminTest::testPageList from Symfony\Cmf\SimpleCmsBundle\Tests\WebTest\Admin
7476
1x in PageAdminTest::testPageEdit from Symfony\Cmf\SimpleCmsBundle\Tests\WebTest\Admin
7577
78+
Now, you can work on fixing these errors. Once you fixed them all, the command
79+
will end with ``0`` (success) and you're save!
80+
81+
.. sidebar:: Using the Weak Deprecations Mode
82+
83+
Sometimes, you can't fix all deprecations (e.g. something that is
84+
deprecated in 2.6 and you still need to support 2.3). In these cases, you
85+
can still use the bridge to fix as many deprecations as possible and then
86+
switch to the weak test mode to make your tests pass again. You can do this
87+
by using the ``SYMFONY_DEPRECATIONS_HELPER`` env variable:
88+
89+
.. code-block:: xml
90+
91+
<!-- phpunit.xml.dist -->
92+
<phpunit>
93+
<!-- ... -->
94+
95+
<php>
96+
<env name="SYMFONY_DEPRECATIONS_HELPER" value="weak"/>
97+
</php>
98+
</phpunit>
99+
100+
(you can also execute the command like ``SYMFONY_DEPRECATIONS_HELPER=weak phpunit``).
101+
76102
.. _upgrade-major-symfony-composer:
77103

78104
2) Update to the New Major Version via Composer
79105
-----------------------------------------------
80106

81-
If your code is deprecation free, you can update the Symfony library via
107+
Once your code is deprecation free, you can update the Symfony library via
82108
Composer by modifying your ``composer.json`` file:
83109

84110
.. code-block:: json
@@ -89,14 +115,14 @@ Composer by modifying your ``composer.json`` file:
89115
"require": {
90116
"symfony/symfony": "3.0.*",
91117
},
92-
"...": "...",
118+
"...": "..."
93119
}
94120
95121
Next, use Composer to download new versions of the libraries:
96122

97123
.. code-block:: bash
98124
99-
$ composer update symfony/symfony
125+
$ composer update --with-dependencies symfony/symfony
100126
101127
.. include:: /cookbook/upgrade/_update_all_packages.rst.inc
102128

0 commit comments

Comments
 (0)