You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
$this->addWarning('Support for using expectException() with PHPUnit\Framework\Error\Deprecated is deprecated and will be removed in PHPUnit 10. Use expectDeprecation() instead.');
Triggering these warnings is great because it helps people upgrade their code and get ready for the next version of PHPUnit. In Symfony-land deprecations are handled using @trigger_error('message', E_USER_DEPRECATED); - this allows the PHPUnit-Bridge component to manage deprecations triggered by code. It allows the projects to choose when they tackle the technical debt on their own terms. Drupal has also adopted this way of managed deprecated code.
It'd be great if there was a option in PHPUnit to trigger silenced deprecations instead of a warning. I propose that we add a TestCase::addDeprecation() method that depending on a flag in PHPUnit's configuration either calls TestCase::addWarning() or @trigger_error('message', E_USER_DEPRECATED);. The default should be to continue to use the warning system but then projects such as Drupal can set the flag to use their existing tools to manage how they cope with deprecations.
The text was updated successfully, but these errors were encountered:
It'd be great if there was a option in PHPUnit to trigger silenced deprecations instead of a warning.
My experience is: if something can be silenced, it will be silenced. And at the time when something is removed that was deprecated before and warned about the developers who silenced the warning will scream: we never saw this coming! So, no, I am against adding an option to silence these warnings.
@sebastianbergmann I can see how an option to ignore these errors might be too tempting. Good point. How about adding a method alongside addWarning() to add PHPUnit deprecations - something like addDeprecation so that project like Drupal can override this method to trigger a silenced deprecation. Note that using @trigger_error('message', E_USER_DEPRECATED); does not cause the deprecation to be silenced when running a test with Symfony's PHPUnitBridge - it causes the deprecation to be reported in a different way.
At the moment PHPUnit deprecates code by calling
TestCase::addWarning()
for examplephpunit/src/Framework/TestCase.php
Line 582 in c82c932
Triggering these warnings is great because it helps people upgrade their code and get ready for the next version of PHPUnit. In Symfony-land deprecations are handled using
@trigger_error('message', E_USER_DEPRECATED);
- this allows the PHPUnit-Bridge component to manage deprecations triggered by code. It allows the projects to choose when they tackle the technical debt on their own terms. Drupal has also adopted this way of managed deprecated code.It'd be great if there was a option in PHPUnit to trigger silenced deprecations instead of a warning. I propose that we add a
TestCase::addDeprecation()
method that depending on a flag in PHPUnit's configuration either callsTestCase::addWarning()
or@trigger_error('message', E_USER_DEPRECATED);
. The default should be to continue to use the warning system but then projects such as Drupal can set the flag to use their existing tools to manage how they cope with deprecations.The text was updated successfully, but these errors were encountered: