Skip to content

Avoid mocks without expectations#7306

Merged
derrabus merged 1 commit intodoctrine:4.4.xfrom
derrabus:chore/mocks-without-expectations
Feb 5, 2026
Merged

Avoid mocks without expectations#7306
derrabus merged 1 commit intodoctrine:4.4.xfrom
derrabus:chore/mocks-without-expectations

Conversation

@derrabus
Copy link
Copy Markdown
Member

@derrabus derrabus commented Feb 4, 2026

Q A
Type improvement
Fixed issues N/A

Summary

PHPUnit 12.5 triggers a notice if we create a mock object and don't configure any expectations on that object. A stub would suffice in that case. This PR is a first step towards separating mocks and stubs. It fixes all easy picks that I could find.

Some of our tests created mocks of the DateTimeImmutable class. I don't find that very reasonable, so I converted those mocks to actual DateTimeImmutable instances.

@derrabus derrabus added this to the 4.4.2 milestone Feb 4, 2026
@derrabus derrabus requested review from greg0ire and morozov February 4, 2026 17:14
@derrabus derrabus merged commit 8381210 into doctrine:4.4.x Feb 5, 2026
136 checks passed
@derrabus derrabus deleted the chore/mocks-without-expectations branch February 5, 2026 06:09
derrabus added a commit to derrabus/dbal that referenced this pull request Feb 5, 2026
* 4.4.x:
  Avoid mocks without expectations (doctrine#7306)
derrabus added a commit to derrabus/dbal that referenced this pull request Feb 5, 2026
* 4.5.x:
  Avoid mocks without expectations (doctrine#7306)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants