Make the PHPStan sites/files exclusion test actually run PHPStan - #54
Merged
Conversation
The quick test "phpstan excludes nested files directory descendants" ran in a bare project with no composer.json, so vendor/bin/phpstan was never installed and the wrapper exited 127 before any analysis. Both assertions then passed vacuously: the output could never contain the probe file path because PHPStan never listed any files at all (#50). Move the coverage into the full-install test, where real PHPStan runs. The probe file under sites/default/files/php/twig/ is valid PHP, so error output cannot distinguish "excluded" from "analysed and clean"; the --debug per-file listing can. A positive control asserts sites/default/settings.php appears in that listing, so the exclusion check fails loudly if PHPStan ever stops analysing rather than passing silently again.
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.
Closes #50.
Problem
The quick test
phpstan excludes nested files directory descendantsran in a bare project with nocomposer.json, so the installer never installedvendor/bin/phpstanand the wrapper exited 127 before any analysis. Both assertions passed vacuously — the test would have stayed green even with theexcludePathsentries completely broken.Fix
phpstan config includes default paths and excludes after install).DCQ_FULL_TESTS=1full-install test, where real PHPStan runs: a valid-PHP probe file atweb/sites/default/files/php/twig/test-subdir/should-not-scan.phpjoins the shared fixtures, and aphpstan analyse --debug -c phpstan.neon web/sitesrun asserts the per-file listing omits it.sites/default/settings.php, so the exclusion check fails loudly if PHPStan ever stops analysing instead of passing silently. The probe is deliberately valid PHP because error output alone cannot distinguish "excluded" from "analysed and clean" — only the--debugfile listing can.Tests
DCQ_FULL_TESTS=1 bats ./tests/test.bats --filter "fresh install"passes locally (127s), confirmingsettings.phpappears in the analysed-file listing while the probe does not.