Problem/Motivation
Discovered in #2874909-79: Update Symfony components to 3.3.*
#2870194: Ensure that process-isolated tests can use Symfony's PHPunit bridge to catch usages of deprecated code gave us nifty deprecation errors for functional and kernel tests.
It also gave us a way to ignore certain deprecation messages.
However, it only allows this whitelist to work for non-process-isolated tests.
This means unit tests have to say @group legacy and @expectedDeprecation if they want to avoid deprecation errors. This makes the test less valuable because it then ends up testing whether the code is deprecated rather than whether it functions properly.
Also, we should be able to prove that all usages of deprecated code are gone by removing the error from the ignore list without inadvertently leaving behind an expected exception.
Proposed resolution
Allow DeprecationListener to ignore deprecation errors for unit tests.
Comments
Comment #2
mile23Comment #3
alexpottI'm really not sure about this. The point is
getSkippedDeprecationsis a stopgap aimed at getting deprecation reporting working for isolated tests. We shouldn't be upgrading to Symfony 3.3 without doing all the work to ensure that our runtime code does not use deprecated pathways. Otherwise each upgrade just accrues technical debt. I think this isclosed (works as designed)Comment #4
catchYes @group legacy seems like the right way to fix those errors, the deprecation listener should really only be for functional tests where there's no real connection to the deprecated code.
Comment #5
mile23+1 on that.
Well, the thing is you then hide the deprecation error, so you're doing the opposite of what @alexpott mentions above, and you have to make sure and find the test later when it comes time to un-hide it.