PHPUnit 12.5.0 started throwing notices when mocks do not configure expectations, e.g.
* No expectations were configured for the mock object for \Drupal\comment\CommentManagerInterface. You should refactor your test code and use a test stub instead.
Also, the $this->any() expectation is deprecated - a change that will be released in version 12.5.5. This is because the any() expectation is equivalent to having no expectation. Instances of expects($this->any()) should be removed, either by deletion or conversion to a more specific number of expectations.
Steps to reproduce
- Require PHPUnit 12 with Composer.
- Fix compatibility issues with PHPUnit 12 by applying this patch.
- Run the Unit tests for a module with
--display-phpunit-notices. - Observe the PHPUnit notices that occur.
Proposed resolution
Fix instances in the Serialization module.
Remaining tasks
Information on how to review these issues and the types of changes you're likely to find in them is included in the parent issue's comments.
User interface changes
Introduced terminology
API changes
Data model changes
Release notes snippet
Issue fork drupal-3567157
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:
- 3567157-stub-conversion
changes, plain diff MR !14316
Comments
Comment #3
dcam commentedComment #5
dcam commentedComment #6
smustgrave commentedLeft a question on the MR.
Comment #7
dcam commentedI responded to the question.
Comment #8
smustgrave commentedRest of the changes LGTM, following the same script I did for the other ones..
Comment #9
dcam commentedSerialization is not affected by the new deprecation in PHPUnit 12.5.11. This issue can stay RTBC.
Comment #10
godotislate1 comment on the MR.
Comment #11
dcam commentedFeedback was addressed. The failing test is in the list of known, intermittent test failures.
Comment #12
smustgrave commentedFeedback from godoislate appears to be addressed
Comment #14
catchAs with other MRs, this is exposing some test oddities that we might want to revisit later, but I'm happy that it's improving things overall, so we shouldn't block PHPUnit 12 on further refactoring. Would also make the MRs harder to review.
Committed/pushed to main, thanks!