Problem/Motivation

EntityResourceValidationTraitTest calls

    $trait = $this->getMockForTrait('Drupal\rest\Plugin\rest\resource\EntityResourceValidationTrait');

EntityResourceValidationTrait is marked @internal. In Symfony 4, the class loader looks at usages of @internal classes and ensures that the class and the class user are in the same root namespace (i.e. \Drupal). Because the mock exists outside of the \Drupal namespace, this triggers a deprecation error on Symfony 4. Setting to major as we should fix this prior to branching 9.0.x

Proposed resolution

If this issue were prevalent, I would consider trying to fix it in the Symfony class loader, or in our own deprecation listener or in some other global fashion. The actual deprecation error is triggered during a class scan after the test is over, so we can't wrap the ->getMockForTrait method in a custom error handler. Since this one test is the only place where this is an issue, the easiest solution is to replace the mock with a wrapper test class for the trait.

Remaining tasks

User interface changes

API changes

Data model changes

Release notes snippet

Support from Acquia helps fund testing for Drupal Acquia logo

Comments

mikelutz created an issue. See original summary.

mikelutz’s picture

larowlan’s picture

Status: Needs review » Reviewed & tested by the community
Wim Leers’s picture

Issue tags: +API-First Initiative

LGTM!

  • catch committed 77286be on 8.8.x
    Issue #3085673 by mikelutz: [Symfony 4]...
catch’s picture

Status: Reviewed & tested by the community » Fixed

Committed 77286be and pushed to 8.8.x. Thanks!

Status: Fixed » Closed (fixed)

Automatically closed - issue fixed for 2 weeks with no activity.