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

Command icon 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

mondrake created an issue. See original summary.

Version: 10.1.x-dev » 11.x-dev

Drupal core is moving towards using a “main” branch. As an interim step, a new 11.x branch has been opened, as Drupal.org infrastructure cannot currently fully support a branch named main. New developments and disruptive changes should now be targeted for the 11.x branch, which currently accepts only minor-version allowed changes. For more information, see the Drupal core minor version schedule and the Allowed changes during the Drupal core release cycle.

spokje’s picture

Title: [PHPUnit 10.1] assertObject[Not]HasAttribute() is deprecated and will be removed in PHPUnit 10 » Update to PHPUnit 9.6.13 and replace deprecated assertObject[Not]HasAttribute()
Issue summary: View changes

spokje’s picture

Version: 11.x-dev » 10.1.x-dev

spokje’s picture

Issue summary: View changes

I 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.

spokje’s picture

Issue summary: View changes
spokje’s picture

Status: Active » Needs review
mondrake’s picture

Status: Needs review » Reviewed & tested by the community

Thank you!

longwave’s picture

Status: Reviewed & tested by the community » Needs work
Issue tags: +Needs reroll

Needs rebase following the commit of Symfony 6.4.

spokje’s picture

Status: Needs work » Reviewed & tested by the community
Issue tags: -Needs reroll

Rerolled

spokje’s picture

Issue summary: View changes
quietone’s picture

Version: 10.1.x-dev » 11.x-dev

  • quietone committed 3e9e43f0 on 11.x
    Issue #3358319 by Spokje, mondrake, longwave: Update to PHPUnit 9.6.13...

  • quietone committed d2d5cd58 on 10.2.x
    Issue #3358319 by Spokje, mondrake, longwave: Update to PHPUnit 9.6.13...
quietone’s picture

Status: Reviewed & tested by the community » Fixed
Issue tags: +10.2.0 release notes

Committed 3e9e43f and pushed to 11.x.

Committed d2d5cd5 and pushed to 10.2.x.

Thanks!

Status: Fixed » Closed (fixed)

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