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.

Remaining tasks

User interface changes

API changes

Data model changes

Comments

Mile23 created an issue. See original summary.

mile23’s picture

alexpott’s picture

I'm really not sure about this. The point is getSkippedDeprecations is 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 is closed (works as designed)

catch’s picture

Status: Active » Closed (won't fix)

Yes @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.

mile23’s picture

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.

+1 on that.

Yes @group legacy seems like the right way to fix those errors

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.