phpunit-wrapper icon indicating copy to clipboard operation
phpunit-wrapper copied to clipboard

Symfony DeprecationHandler produces useless info for deprecations

Open acrobat opened this issue 6 years ago • 0 comments

When you have the symfony/phpunit-bridge installed, codeception will register the test listener to enhance the test suite and deprecation output. But because the tests run through codeception the information in the output about where a certain deprecation is triggered is quite useless.

Normally the will show where a deprecation is triggered but it now only shows Application::run as the trigger location. In a "normal" phpunit setup it shows the correct class where the deprecation is triggered.

Phpunit output:

2x: The "%provider_keys%" is deprecated. Use "toolbar_firewall_names" instead
    2x in ConfigurationTest::testConfigGeneratesAsExpected from Kunstmaan\AdminBundle\Tests\DependencyInjection

Codeception output:

2x: The "%provider_keys%" is deprecated. Use "toolbar_firewall_names" instead
    2x in Application::run from Codeception

This is checked in this part of the deprecation handler: https://github.com/symfony/phpunit-bridge/blob/a00e342346a34c87bd11c3d4f2f93cee1585fb2c/DeprecationErrorHandler.php#L116

The deprecation handler will get the full trace and will wall back over it until it finds a "usefull" class that triggered the deprection. So it will skip phpunit classes, but in the codeception setup it will find codeception classes first so it thinks these classes have triggered the deprecation.

Example phpunit trace

* actual class triggering the deprecation
* phpunit runner
* phpunit
* phpunit

Example codeception trace

* actual class triggering the deprecation
* phpunit runner
* phpunit
* phpunit
* Symfony console
* codeception internal classes
* codeception application

acrobat avatar Aug 30 '18 10:08 acrobat