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.
Merge request link
Remaining tasks
User interface changes
API changes
Data model changes
Release notes snippet
Issue fork drupal-3419201
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:
- 3419201-remove-withconsecutive-in
changes, plain diff MR !6451
Comments
Comment #3
longwaveNot 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
$thisand then that becomes more complicated too.Comment #4
spokje*cough* PHPStan *cough*
Comment #5
longwaveRealised I missed some cases as well.
Comment #6
spokjeCode 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,
Comment #8
catchThis 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!