Repository navigation
fix: point the phpunit schema at the vendored copy - #102
Merged
Merged
Conversation
Infection validates phpunit.xml.dist against xsi:noNamespaceSchemaLocation before it runs a single mutant. With an https URL that validation is a network fetch, so the required mutation job fails whenever schema.phpunit.de is unreachable, which is what a 522 does. The URL also pinned the 13.1 series while this package installs a newer PHPUnit, so the schema no longer described the installed version even when the host was reachable. Use the relative path instead. It resolves inside the installed package, needs no network, and always matches the installed version. This is the value phpunit --generate-configuration writes itself: it prefers vendor/phpunit/phpunit/phpunit.xsd and only falls back to the URL when that file is absent.
Codecov Report✅ All modified and coverable lines are covered by tests. 📢 Thoughts on this report? Let us know! |
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.
xsi:noNamespaceSchemaLocationpointed athttps://schema.phpunit.de/13.1/phpunit.xsd. That is wrong two ways.It makes the mutation job depend on the network
Infection validates
phpunit.xml.distagainst that schema before it runs a single mutant (XmlConfigurationManipulator::validate()). A URL there is therefore a live HTTP fetch on every mutation run. Whenschema.phpunit.deanswers 522 the leg dies in under a minute having mutated nothing:schema.phpunit.deis currently in exactly that state, which is what surfaced this.The series does not match the installed PHPUnit
The URL pins
13.1while consumers install PHPUnit 13.3. PHPUnit's own migration rewrites any URL toVersion::series(), so the config is silently describing a schema that is two minor versions behind the code it validates. A 13.3-only attribute would be reported invalid, and Infection would refuse to run.The fix
Point at the vendored copy:
This is not a workaround, it is what PHPUnit itself writes.
phpunit --generate-configurationprefers the relative path and only falls back to the URL when the file is absent:phpunit --migrate-configurationagrees: it returns early on a relative path, and rewrites any URL to the installed series. A relative path is the steady state; a URL is the fallback.Verification
valid=yes, 0 errors, while the URL fails withFailed to locate the main schema resource.webware-console, where the mutation leg passes withenable_infection: trueandmin_msi: 100.schema/13.1.xsd,13.2.xsdand the vendored root, so no existing content depends on the old pin.