Problem/Motivation
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 notices in the views and views_ui modules.
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-3569424
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:
- 3569424-stub-conversion
changes, plain diff MR !14485
Comments
Comment #3
dcam commentedComment #4
dcam commentedComment #5
dcam commentedComment #6
dcam commentedNeeds work due to PHPUnit 12.5.11 and a new deprecation.
Comment #7
dcam commentedI finally got this one to a point where I'm happy with it.
There are 14 failures in
FieldPluginBaseTestwhen the tests are run on PHPUnit 12. This happens with or without the MR. I haven't been able to figure out the reason for these failures. It says the closure objects in the render arrays don't match. I'd like to defer fixing this to the PHPUnit 12 update issue.Comment #8
smustgrave commentedThis one was a beast.
Reviewed all your threads and have no objections to your comments.
Running locally OK (371 tests, 1730 assertions)
All instances of any() appear to be gone in Views.
Not really sure what to test on this one, feel weird since it's a large MR but I have no issues.
Comment #11
catchSome of the other MRs lulled me into a false sense of a security, quite a lot in this one.
All looks fine - thanks again for the self-review comments.