Optional $skipWhenEmpty parameter for #[DataProvider] and #[DataProviderExternal]#6565
Draft
sebastianbergmann wants to merge 1 commit intomainfrom
Draft
Optional $skipWhenEmpty parameter for #[DataProvider] and #[DataProviderExternal]#6565sebastianbergmann wants to merge 1 commit intomainfrom
$skipWhenEmpty parameter for #[DataProvider] and #[DataProviderExternal]#6565sebastianbergmann wants to merge 1 commit intomainfrom
Conversation
Owner
Author
|
@stof Is this what you had in mind? |
Codecov Report✅ All modified and coverable lines are covered by tests. Additional details and impacted files@@ Coverage Diff @@
## main #6565 +/- ##
=========================================
Coverage 96.90% 96.91%
- Complexity 7604 7613 +9
=========================================
Files 819 819
Lines 23512 23533 +21
=========================================
+ Hits 22785 22806 +21
Misses 727 727 ☔ View full report in Codecov by Sentry. |
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.
This implements an optional
$skipWhenEmptyparameter (defaulting tofalse) for the#[DataProvider]and#[DataProviderExternal]attributes. When set totrue, a data provider that returns an empty iterable will cause the test to be skipped instead of triggering an error.Usage:
Note: Parameter names are not covered by the backward compatibility promise for PHPUnit.
When all data providers for a test method return no data and at least one of them has
skipWhenEmpty: true, the test is created as a single test case that skips itself with the message "The data provider for this test provided no data, which is explicitly permitted". The default behavior (error on empty data provider) is unchanged.Closes #6404.