Skip to content

Fix Major upgrade article for 2.7.1 changes #5394

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 1 commit into from
Aug 8, 2015
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
40 changes: 32 additions & 8 deletions cookbook/upgrade/major_version.rst
Original file line number Diff line number Diff line change
Expand Up @@ -59,17 +59,17 @@ more confidence.
Deprecations in PHPUnit
~~~~~~~~~~~~~~~~~~~~~~~

By default, PHPUnit will handle deprecation notices as real errors. This means
that all tests are aborted because it uses a BC layer.
When you run your tests using PHPUnit, no deprecation notices are shown.
To help you here, Symfony provides a PHPUnit bridge. This bridge will show
you a nice summary of all deprecation notices at the end of the test report.

To make sure this doesn't happen, you can install the PHPUnit bridge:
All you need to do is install the PHPUnit bridge:

.. code-block:: bash

$ composer require --dev symfony/phpunit-bridge

Now, your tests execute normally and a nice summary of the deprecation notices
is displayed at the end of the test report:
Now, you can start fixing the notices:

.. code-block:: text

Expand All @@ -87,12 +87,36 @@ is displayed at the end of the test report:
2x in PageAdminTest::testPageList from Symfony\Cmf\SimpleCmsBundle\Tests\WebTest\Admin
1x in PageAdminTest::testPageEdit from Symfony\Cmf\SimpleCmsBundle\Tests\WebTest\Admin

Once you fixed them all, the command ends with ``0`` (success) and you're
done!

.. sidebar:: Using the Weak Deprecations Mode

Sometimes, you can't fix all deprecations (e.g. something was deprecated
in 2.6 and you still need to support 2.3). In these cases, you can still
use the bridge to fix as many deprecations as possible and then switch
to the weak test mode to make your tests pass again. You can do this by
using the ``SYMFONY_DEPRECATIONS_HELPER`` env variable:

.. code-block:: xml

<!-- phpunit.xml.dist -->
<phpunit>
<!-- ... -->

<php>
<env name="SYMFONY_DEPRECATIONS_HELPER" value="weak"/>
</php>
</phpunit>

(you can also execute the command like ``SYMFONY_DEPRECATIONS_HELPER=weak phpunit``).

.. _upgrade-major-symfony-composer:

2) Update to the New Major Version via Composer
-----------------------------------------------

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

.. code-block:: json
Expand All @@ -103,14 +127,14 @@ Composer by modifying your ``composer.json`` file:
"require": {
"symfony/symfony": "3.0.*",
},
"...": "...",
"...": "..."
}

Next, use Composer to download new versions of the libraries:

.. code-block:: bash

$ composer update symfony/symfony
$ composer update --with-dependencies symfony/symfony

.. include:: /cookbook/upgrade/_update_dep_errors.rst.inc

Expand Down