Problem/Motivation
Over in #3393151: Update composer dependencies for Drupal 10.2 we've discovered that phpunit/phpunit has backported assertObject[Not]HasProperty() from 10.1.x to the 9.6.x branch.
Let's update to PHPUnit 9.6.13 and replace deprecated assertObject[Not]HasAttribute() with assertObject[Not]HasProperty().
Doing this in a separate issue means we can backport this down to core 10.1.x and remove a bunch of deprecation and PHPStan suppression and make it easier to backport issues from 11.x.
Later stuff like #7 dawned on me, making backporting even more important.
Upon revisit: Let's treat this as we did for the other replacements of deprecated PHPUnit asserts: Replace in core, and treat as deprecation warning so contrib can catch up.
The main difference between the 2 MRs is that 10.1.x doesn't need to remove the deprecations from the PHPStan baseline.
Proposed resolution
- Bump phpunit/phpunit to 9.6.13, also use this version number in the composer.json, because the new baseline of PHPStan won't pass with any lower version.
- Replace deprecated assertObject[Not]HasAttribute() with assertObject[Not]HasProperty().
- Create a new PHPStan baseline (10.2.x+ only).
- Adjust the (slighty) changed deprecation messages in core/tests/Drupal/Tests/Traits/PhpUnitWarnings.php.
- Remove the suppressions from core/.deprecation-ignore.txt.
Remaining tasks
User interface changes
API changes
Data model changes
Release notes snippet
Issue fork drupal-3358319
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:
- 3358319-update-to-phpunit
changes, plain diff MR !4999
- 3358319-10.1.x
changes, plain diff MR !5000
Comments
Comment #3
spokjeComment #5
spokjeComment #7
spokjeI forgot we didn't backport the whole deprecation-through-phpstan thingy down to 10.1.x, so the changes there are less dramatic than I expected.
I think we _really_ do want to backport down to 10.1.x though, since by suppression hard fails in 10.1.x and failing on the deprecations in 10.2.x+ we allow contrib to _not_ have support two different version for support both.
By keeping the suppression in 10.1.x only, we allow contrib to make the change, but won't make any existing test fail hard.
Comment #8
spokjeComment #9
spokjeComment #10
mondrakeThank you!
Comment #11
longwaveNeeds rebase following the commit of Symfony 6.4.
Comment #12
spokjeRerolled
Comment #13
spokjeComment #14
quietone commentedComment #17
quietone commentedCommitted 3e9e43f and pushed to 11.x.
Committed d2d5cd5 and pushed to 10.2.x.
Thanks!