Contributed by
Nicolas Grekas
in #13398.
In computer science, the bridge pattern is meant to "decouple an abstraction from its implementation so that the two can vary independently". The bridge uses encapsulation, aggregation and can use inheritance to separate responsibilities into different classes.
Symfony defines several bridges to abstract third-party libraries such as Doctrine, Monolog, Swiftmailer and Twig. In Symfony 2.7 we added a new bridge for PHPUnit. This first version of the bridge provides the following features:
The last feature is very useful for Symfony developers that are preparing the transition to Symfony 3. First, install the new PHPUnit bridge in your application executing the following command:
1 | $ composer require --dev "symfony/phpunit-bridge":2.7.x@beta
|
Then, execute the test suite and you'll see a report of the deprecated Symfony features that your application is still using:
By default, deprecation notices will make tests fail. This behavior can be
controlled with the SYMFONY_DEPRECATIONS_HELPER
environment variable (default
value = strict
). Change the value of that variable to weak
to make the
bridge ignore deprecation notices. This is useful for projects that must use
deprecated interfaces for backward compatibility reasons.
In addition, you can safely mark a test as legacy using any of the following methods:
Legacy
prefix;testLegacy
;provideLegacy
or getLegacy
;@group
legacy annotation to its class or method.What a Symfony developer should know about the framework: News, Jobs, Tweets, Events, Videos,...