Problem/Motivation
PHPUnit 13 deprecates usage of with*() without expects() in mocks.
See pipeline raw logs in #3574681: [Nov 2026] Introduce support for PHPUnit 13.5 for full report.
Proposed resolution
Before adopting PHPUnit 13, fix the usages, either converting the mocks to stubs, or adding explicit expectations on the calls to the mocked method.
In this issue, do a second round with a limited number of fixes.
Remaining tasks
User interface changes
Introduced terminology
API changes
Data model changes
Release notes snippet
Issue fork drupal-3592112
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:
- 3592112-more-stubs
changes, plain diff MR !16327
- 3592112-fix-usage-of
changes, plain diff MR !15882
Comments
Comment #3
mondrakeComment #4
dcam commentedI found a few expectations that I think can be removed since they're unused. I left comments on the MR.
Comment #5
mondrakeThanks for review
Comment #6
dcam commentedMy feedback was addressed. The MR follows the patterns for fixing these issues that were established in phase 1. It looks good to me.
Comment #7
quietone commentedAll in order here, I updated credit.
Comment #8
longwaveI think almost all of these can be stubs instead of mocks? I only looked at a few but each one that I did check it seems that we don't really care about whether the mock is called at all, we just care that it returns something specific, so we can use stubs? That simplifies the tests and means we don't need to add additional setup methods or data provider arguments in some places.
Comment #10
mondrake#8 added a new MR with the feedback from @longwave. I just focused on that, preferred to do baby steps. The original intent was to stick to mocks, but of course if we can change to stubs even better. Also if you believe additional refactoring could do please comment.
Comment #11
dcam commentedI found a couple of classes that I think need attention. Please check my comments and let me know what you think.
Comment #13
mondrakeall correct, tx
Comment #14
dcam commentedThank you for considering my comments. This looks good to me now.
Comment #15
catchNeeds a rebase.
Comment #16
mondrakeMerged with main head, no conflicts.
Comment #18
catchCommitted/pushed to main, thanks!