Problem/Motivation
Drupal 11 no longer includes the Symfony PHPUnit bridge, so \Symfony\Bridge\PhpUnit\ExpectDeprecationTrait is not available there. The replacement, \Drupal\TestTools\Extension\DeprecationBridge\ExpectDeprecationTrait, only exists in Drupal 11.0 and later, so it is not available in Drupal 10.3 or 10.4.
Feeds supports Drupal ^10.3 || ^11 and runs CI against both major versions. That makes deprecation tests a little awkward: using either trait directly breaks on the other supported core version.
This came up in #3461140: (PHPStan) Deprecate calling PluginBase::getConfiguration() with a parameter, where PluginBaseTest handles it with an inline class_alias() that maps the Symfony trait to the core trait name on Drupal 10. That works, but it leaves the compatibility workaround in one test class where future deprecation tests are unlikely to find it.
Proposed resolution
Move the workaround out of PluginBaseTest and into one reusable place. For example, add a Drupal\Tests\feeds\Traits\ExpectDeprecationTrait that resolves to the right implementation for the current Drupal version.
Future deprecation tests could then use the Feeds trait directly without needing their own version-specific workaround.
Both core traits expose the same expectDeprecation(string $message) method and both require the test to be in @group legacy, so the test code itself should not need to change beyond using the shared trait.
Remaining tasks
- Add the shared trait, or a bootstrap-level alias, for the deprecation expectation helper.
- Update
PluginBaseTestto use the shared workaround. - Confirm both
phpunitandphpunit (previous major)CI jobs pass. - Remove the workaround once Feeds only supports Drupal 11 and later.
Issue fork feeds-3608090
Show commands
Start within a Git clone of the project using the version control instructions.
Or, if you do not have SSH keys set up on git.drupalcode.org:
Comments