feat: show test warning details in generated PHPUnit configs - #53
Merged
Conversation
… installed phpunit Flarum's integration TestCase now reports repeated database queries as PHPUnit warnings — a query run once per record fails the test, one repeated for the same few values warns instead. PHPUnit only prints the detail of a warning when displayDetailsOnTestsThatTriggerWarnings is set; without it a run says 'Warnings: 11' and nothing about what they were. Both generated configs now set it, so extension authors get the finding rather than a count. The unit config also pointed at a remote 10.5 schema while the integration one used the installed copy. Flarum 2.x requires PHPUnit ^12.5, so the remote reference both drifts from what is installed and needs the network to validate. It now matches the integration config, which is what extensions in the wild use. Both configs validate against a real PHPUnit 12 schema.
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.
Why
Flarum's integration
TestCasenow inspects each request for N+1 query patterns (flarum/framework#4871). A query run once per record fails the test; one repeated for the same few values raises a warning instead, since it doesn't grow with the forum.PHPUnit only prints what a warning said when
displayDetailsOnTestsThatTriggerWarningsis enabled. Without it a run ends with:— visible, but with no indication of which queries or where. Both generated configs now set the flag, so extension authors get the finding itself. Since
backendTestingisupdatable, existing extensions pick it up by re-runningflarum-cli infra backendTesting, not just newly generated ones.Also: the unit config's schema reference
phpunit.unit.xmlpointed athttps://schema.phpunit.de/10.5/phpunit.xsdwhilephpunit.integration.xmlused../vendor/phpunit/phpunit/phpunit.xsd. Flarum 2.x requires PHPUnit^12.5, so the remote reference was both a version behind what gets installed and dependent on the network to validate. It now matches the integration config — which is also what extensions in the wild use (I checked several standalone 2.x extensions rather than core, whose deeper path in the monorepo isn't representative).Verification
phpunit.xsdviaxmllint --schema.yarn test— 22 suites, 176 tests, Prettier clean.