[Testing] Check fixtures use *.php.inc suffix, not bare *.inc - #8306
Merged
Conversation
Bare "*.inc" files in Fixture/ directories are never picked up by yieldFilesFromDirectory(), which defaults to a "*.php.inc" suffix. 8 such files existed and silently never ran, 2 of them accidental "* copy.inc" file-manager duplicates. Extend scripts/no-php-file-in-fixtures.php to report them, and cover tests/ as well as rules-tests/ for this check.
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.
yieldFilesFromDirectory()defaults to a*.php.incsuffix, so a fixture named*.incis silently never executed. 8 such files existed in the repo — including 2 accidental file-manager duplicates named* copy.inc.Script change
scripts/no-php-file-in-fixtures.phpalready rejected*.phpfiles inFixture/. It now also rejects any*.incthat is not*.php.inc, and coverstests/in addition torules-tests/.private function findIncompleteIncFiles(array $directories): array { $finder = new Finder() ->files() ->in($directories) ->path('/Fixture') ->notPath('Source') + ->name('*.inc') + ->notName('*.php.inc')Output on the offending state:
Fixture triage
6 renamed to
*.php.incand now run — all pass, so this recovers real coverage that was dead:ArgumentAdderRector/Fixture/skip_named_argumentsSetcookieRector/Fixture/skip_non_integer_third_argJsonValidateRector/Fixture/skip_json_validate_invalid_depth(was.php copy.inc)ArrayFirstLastRector/Fixture/skip_as_assign_variableAddParamTypeBasedOnPHPUnitDataProviderRector/Fixture/skip_with_nested_methodBoolReturnTypeFromBooleanStrictReturnsRector/Fixture/skip_possible_void1 had a stale expectation —
tests/Issues/InlineTags/Fixture/with_punctuation.php.inc. Its expected output predates #6674 and dropped part of the docblock text. Actual current output is correct (text preserved verbatim), so the expectation was corrected to match:1 removed —
ReturnUnionTypeRector/Fixture/change_nullable_union_different_in_parent.php copy.inc. Never passed: it expectsReturnUnionTypeRectorto add?\stdClasswhere the parent declares the same return, which the rule does not do. Unimplemented-feature WIP, not a regression guard, so it is deleted rather than revived.