Closed (fixed)
Project:
Drupal core
Version:
9.3.x-dev
Component:
phpunit
Priority:
Normal
Category:
Task
Assigned:
Unassigned
Reporter:
Created:
22 Nov 2021 at 12:23 UTC
Updated:
6 Dec 2021 at 16:49 UTC
Jump to comment: Most recent
#3130606: MockBuilder::setMethods is deprecated in PHPUnit8 and removed from PHPUnit10 properly removes all MockBuilder::setMethods calls but the issue #3194768: The plugin system should only consider NULL context values to be empty to facilitate the use of otherwise FALSE values introduced one call to that method again in the Drupal\Tests\Component\Plugin\Context\ContextTest file.
See:
$mock_definition = $this->getMockBuilder('Drupal\Component\Plugin\Context\ContextDefinitionInterface')
->setMethods(['getDefaultValue'])
->getMockForAbstractClass();Replace the setMethods() method by the onlyMethods() method.
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
Comment #3
paulocsComment #4
paulocsComment #5
longwaveAs https://github.com/sebastianbergmann/phpunit/issues/4775 is still open maybe we should temporarily add our own deprecation to avoid this happening again?
Comment #6
paulocsHow is it possible to trigger a deprecation from a third party method call? Do you have any example so i can see how its done?
Comment #7
longwaveWe could add a method override to one of our traits (maybe PhpUnitCompatibilityTrait) that triggers the deprecation and then just calls the parent method?
Comment #8
longwaveIgnore #5/#7, I don't think this is feasible as MockBuilder is declared final so even if we jump through hoops to replace it we can't then extend it as we would need to.
Therefore we can't fix that here and will have to wait for upstream, in the meantime this patch is RTBC.
Comment #9
mondrakeYep that's in the milestones for PHPUnit 9.6, but ATM the situation of PHPUnit releases' timing is rather unclear.
Comment #12
catchCommitted/pushed to 9.4.x and cherry-picked to 9.3.x, thanks!
Thanks for investigating whether we could add our own deprecation notice, but agreed that looks like a pain.