You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Found while modernizing fof/synopsis's configs by hand (FriendsOfFlarum/synopsis#7) and asking why the upgrade tool hadn't already done it. Two independent defects, either fatal alone:
replacements(file: string): Replacement[]{if(!file.endsWith('.php'))return[];// ← XML files never get replacementsreturn[
...,(file,code)=>{if(!file.endsWith('.xml'))returnnull;// ← unreachablereturn{// ← String.replace with regex syntax in a plain string: literal match, hits nothingupdated: code.replace('xsi:noNamespaceSchemaLocation="([^"]+)"','...'),};},];}
So every extension run through upgrade:2.0 kept its PHPUnit 9.3-era config — which PHPUnit 12 tolerates but flags as a deprecation on every run, hides query-guard warnings behind summary counts, and pins the schema to a URL that no longer matches the installed phpunit.
The fix
modernizePhpunitXml() in its own dependency-free module, wired through a restructured dispatch (.php and phpunit*.xml each get their own path; root-level phpunit.xml added to targets). The transform converts to the shape this CLI scaffolds:
schema from the vendored phpunit, depth-aware (tests/… → ../vendor/…, root → vendor/…)
removed-in-10 attributes dropped; backupStaticAttributes → backupStaticProperties keeping its value
cacheDirectory + displayDetailsOnTestsThatTriggerWarnings inserted in scaffold order
<coverage> → <source> (include list preserved); <listeners> removed
testsuites and per-file settings untouched; idempotent on already-modern configs
Verification
9 new jest tests written RED first (fixtures are synopsis's actual old configs): schema paths at both depths, attribute removal/rename, insertions, coverage→source, listeners removal, preservation, idempotency
Full suite 190/190, Prettier clean
End-to-end: the built binary run against a fixture extension carrying the old config produced byte-for-byte the scaffolded modern shape
The upgrade step's XML rewrite has never run: the callback sat behind
an early return that only let .php files through, and even if reached,
it called String.replace with regex syntax in a plain string — a
literal match that hits nothing. Every upgraded extension kept its
PHPUnit 9.3-era config, which PHPUnit 12 flags as a deprecation on
every run.
The rewrite is now a real transform in its own module, converting
configs to the shape the CLI scaffolds: schema resolved from the
vendored phpunit (relative to the config's own directory, so root-level
configs resolve without ../), the attributes PHPUnit 10 removed dropped
or renamed (backupStaticAttributes becomes backupStaticProperties with
its value kept), cacheDirectory and
displayDetailsOnTestsThatTriggerWarnings inserted in scaffold order so
flarum/testing's query guard warnings surface in output, coverage's
include list moved to <source>, and the Mockery listeners block
removed. Testsuites and per-file settings are preserved, and the
transform is idempotent on already-modern configs.
Root-level phpunit.xml files are now targeted alongside tests/.
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
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.
The bug — the XML rewrite has never run
Found while modernizing fof/synopsis's configs by hand (FriendsOfFlarum/synopsis#7) and asking why the upgrade tool hadn't already done it. Two independent defects, either fatal alone:
So every extension run through
upgrade:2.0kept its PHPUnit 9.3-era config — which PHPUnit 12 tolerates but flags as a deprecation on every run, hides query-guard warnings behind summary counts, and pins the schema to a URL that no longer matches the installed phpunit.The fix
modernizePhpunitXml()in its own dependency-free module, wired through a restructured dispatch (.phpandphpunit*.xmleach get their own path; root-levelphpunit.xmladded to targets). The transform converts to the shape this CLI scaffolds:tests/…→../vendor/…, root →vendor/…)backupStaticAttributes→backupStaticPropertieskeeping its valuecacheDirectory+displayDetailsOnTestsThatTriggerWarningsinserted in scaffold order<coverage>→<source>(include list preserved);<listeners>removedVerification