Problem/Motivation

PHPUnit is deprecating withConsecutive(), so we need to find replacements.

Steps to reproduce

Proposed resolution

Based on #3306554-29: InvocationMocker::withConsecutive() is deprecated in PHPUnit 9.6 and removed from PHPUnit 10 we can use callbacks to assert the order of arguments.

Remaining tasks

User interface changes

API changes

Data model changes

Release notes snippet

Issue fork drupal-3419201

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

longwave created an issue. See original summary.

longwave’s picture

Status: Needs work » Needs review

Not massively happy with this solution but it seems the easiest for now. We could switch to Prophecy but that means rewriting far more of the other test methods to also use Prophecy. Or we could use a data provider but then I remembered data providers have to be static in PHPUnit 10 and so we can't use $this and then that becomes more complicated too.

spokje’s picture

Status: Needs review » Needs work

*cough* PHPStan *cough*

longwave’s picture

Status: Needs work » Needs review

Realised I missed some cases as well.

spokje’s picture

Status: Needs review » Reviewed & tested by the community

Code changes make sense, maybe not the most elegant, but we used this method in other issues, and as explained by @longwave, this seems to be the "easiest" (in terms of code changes) way,

  • catch committed d2ffc4d8 on 11.x
    Issue #3419201 by longwave, Spokje: Remove withConsecutive() in...
catch’s picture

Status: Reviewed & tested by the community » Fixed

This also looks OK to me, it's maybe stretching the readability of that pattern compared to the simpler examples elsewhere but it's not bad. Committed/pushed to 11.x, thanks!

Status: Fixed » Closed (fixed)

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