fix: prevent TestTransport from increasing phpunit's assertions count#104
Open
podoko wants to merge 1 commit into
Open
fix: prevent TestTransport from increasing phpunit's assertions count#104podoko wants to merge 1 commit into
podoko wants to merge 1 commit into
Conversation
The transport was using asserts in its code that had two impacts : - hiding risky tests from end users that do not perform assertions - prevent users to actually using phpunit's `TestCase::expectNotToPerformAssertions` method
nikophil
reviewed
Jul 8, 2026
Member
There was a problem hiding this comment.
Hello, thank you for this PR, and sorry for the lack of review 😅
I'm afraid that this would break people's CIs, if they rely on the fact that messenger-test do actually perform assertions.
On the other hand, I think this is the way to go: the final user did not explicitly assert something, so the assertions counts should not be impacted.
WDYT if we introduce a new impacts_phpunit_assertions_count config (or a better name), which would default to true. And we would emit a deprecation if this value is true. The same way we are doing it for delay stamp support
In zenstruck/messenger-test v2 we wil deprecate this option, and always prevent the TestTransport to impact assertions count
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
The transport is currently using asserts in its code that have two impacts :
TestCase::expectNotToPerformAssertionsin their tests since the transport might do assertionsThe change aims to only do asserts on failed actions (for instance, failed serialization) in order for risky tests to be visible