Skip to content

test: drop redundant expects($this->any()) from mocks - #67727

Open
TomasVotruba wants to merge 1 commit into
nextcloud:masterfrom
TomasVotruba:phpunit-mock-cleanup
Open

TomasVotruba wants to merge 1 commit into
nextcloud:masterfrom
TomasVotruba:phpunit-mock-cleanup

Conversation

@TomasVotruba

@TomasVotruba TomasVotruba commented Dec 5, 2026 •

Copy link
Copy Markdown

Summary

Drop ->expects($this->any()) from mocks in core tests/. ->method() already allows any number of calls, so the matcher only adds noise. Same behavior, shorter setup.

Kept to core tests/ only to keep the diff reviewable; the same pattern in apps/*/tests can follow in a separate PR.

This was deprecated in PHPUnit 12 - sebastianbergmann/phpunit#6461, will be removed in PHPUnit 14.

TODO

  • Run changed tests locally with sqlite - same results as on master

Checklist

AI (if applicable)

  • The content of this PR was partly or fully generated using AI

@TomasVotruba
TomasVotruba requested review from icewind1991 and salmart-dev and removed request for a team December 5, 2026 22:37
Calling method() on a mock already allows any number of calls, so the explicit any() matcher only adds noise to test setup.

Assisted-by: ClaudeCode:claude-opus-5-5
Signed-off-by: Tomas Votruba <tomas.vot@gmail.com>
@TomasVotruba

Copy link
Copy Markdown
Author

More PHPUnit compatibility PRs coming 👍

This branch has not been deployed

No deployments
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant