Detect the PHPUnit runner for MediaWiki 1.46+#77
Merged
Conversation
7ff9008 to
31def84
Compare
31def84 to
9346482
Compare
9346482 to
7f6315c
Compare
malberts
pushed a commit
that referenced
this pull request
May 21, 2026
Throwaway experiment to find out whether `--group mediawiki-databaseless` short-circuits PHPUnit's test discovery *before* the suite-time hazards fire — i.e. whether modern PHPUnit skips loading test files whose class-level group annotation doesn't match the filter. Predictions for each matrix entry, given the failure mode each branch showed in earlier iterations: - REL1_39 — under the new runner, Scribunto's Scribunto_LuaEngineTestBase::suite() static method blew up at discovery time on MediaWikiServices::getParserFactory(). If --group filtering short-circuits class load, this entry should now pass. Otherwise same failure as before. - REL1_40, REL1_41, REL1_42 — never reached in the prior big-bang attempt (matrix-mate cancellation). Now we'll see. - REL1_43 — same as above. - master — Scribunto_LuaEngineTestBase class wasn't autoloadable (renamed/namespaced on current Scribunto). Same load-vs-filter question. Only LuaLibrary* tests carry `@group Database`; all other unit tests carry `@group mediawiki-databaseless` and would be the ones actually run. Also pulls in two supporting changes from #77 so master has a chance: * installWiki.sh: git clone instead of wget tarball (phpunit.xml.template ships in git but is export-ignored from the archive) * MediaWiki cache key bumped to a one-off `-experiment` suffix so the experimental install actually runs and doesn't shadow itself onto other PRs' caches Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
7f6315c to
7137d31
Compare
MediaWiki 1.46 removed tests/phpunit/phpunit.php in favour of generating a config with `composer phpunit:config` and running vendor/bin/phpunit. Pick the runner by detecting whether the old entry point still exists, so every current and future MediaWiki version is covered without per-version bookkeeping. Scope the new runner to this extension's Unit suite by path, the set the old --testsuite ran: the Integration tests reference optional SemanticMediaWiki test traits that fatal at PHPUnit's collection time when SMW is not installed. phpunit.xml.template is export-ignored from MediaWiki's archive tarball, so fetch it before composer phpunit:config. Add an experimental REL1_46 row; it and master exercise the new runner. Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
Scribunto namespaced its Lua test base as MediaWiki\Extension\Scribunto\Tests\Engines\LuaCommon\LuaEngineTestBase and dropped the legacy Scribunto_LuaEngineTestBase alias on MediaWiki master. The namespaced class is present on every supported MediaWiki (1.43+), so use it directly. Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
7137d31 to
4c30fd4
Compare
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
MediaWiki 1.46 removed the bundled
tests/phpunit/phpunit.phprunner in favour ofcomposer phpunit:config+vendor/bin/phpunit. The matrix'smasterrow fails onthe old invocation (
Could not open input file: tests/phpunit/phpunit.php); it onlylooks green because it is
continue-on-error.What
tests/phpunit/phpunit.phpexists, use it; otherwise drive PHPUnit throughcomposer phpunit:config+vendor/bin/phpunit. No per-version bookkeeping asnewer MediaWiki versions land.
phpunit.xml.templatebeforecomposer phpunit:config. MediaWiki marksit
export-ignore, so it is absent from the source-archive tarball the installscript downloads.
--testsuite bootstrap-components-unitran). The Integration testsuseSemanticMediaWiki test traits, an optional dependency not installed in CI; PHPUnit
loads those files during discovery, so they fatal at collection time before any
group filter applies.
LuaEngineTestBase. Scribunto dropped the legacyScribunto_LuaEngineTestBasealias on master; the namespaced class is present onevery supported MediaWiki (1.43 and up).
REL1_46row so the new runner is exercised on a stablerelease branch as well as
master.Scope and current state
The
REL1_43,REL1_44andREL1_45rows keep the old runner unchanged and staygreen. The new runner now collects and runs on
1.46andmasterinstead of failingat the entry point, but those rows stay
experimentaland red: this extension's unittests rely on the legacy entry point's full-MediaWiki bootstrap and error with
"Premature access to service container" under
vendor/bin/phpunit. Making them greenis a separate test-suite modernization (proper
MediaWikiIntegrationTestCaseusage)and is out of scope here; this change unblocks the runner and turns an opaque
entry-point failure into a real, visible test signal.
Verifying
Local reproduction against MediaWiki master (1.47-alpha) with Scribunto, plus this
pull request's own CI run.