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
Comment | File | Size | Author |
---|---|---|---|
#2 | 3085673-2.drupal.Symfony-4-EntityResourceValidationTraitTest-should-not-get-a-mock-for-an-internal-trait.patch | 1.83 KB | mikelutz |
Comments
Comment #2
mikelutzComment #3
larowlanComment #4
Wim LeersLGTM!
Comment #6
catchCommitted 77286be and pushed to 8.8.x. Thanks!