Improve PHPUnit failure output by including fixture names#7915
Closed
ghostwriter wants to merge 2 commits intorectorphp:mainfrom
Closed
Improve PHPUnit failure output by including fixture names#7915ghostwriter wants to merge 2 commits intorectorphp:mainfrom
ghostwriter wants to merge 2 commits intorectorphp:mainfrom
Conversation
No content changes, just file renames. Signed-off-by: Nathanael Esayeas <nathanael.esayeas@protonmail.com>
Member
|
This disables a way to quickly run specific test fixture like: Instead, full file path has to typed instead: This becomes even more cumbersome, when file paths have similar starts: Saying that, I want to keep the |
Contributor
Author
|
I believe we could have prefixed each fixture name with a 1 character numeric index, to enable and preserve both features, but I'll accept your decision. Thanks for your time. |
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.
Problem
When a test fails using a data provider, PHPUnit currently displays only numeric indexes (for example
#0,#1, etc.). This makes it difficult to identify which specific fixture caused the failure.Users must manually cross-reference the index with the data provider, which is confusing and time-consuming, especially when there are many fixtures.
Solution
This patch updates the output to include the fixture name instead of just the numeric index.
This allows users to immediately identify the failing test case without additional lookup.
Benefits
Before
Numeric index only, no context:
After
Fixture name is displayed, providing clear context:
Summary
This change makes PHPUnit output more informative and significantly reduces the time required to identify failing fixtures.