Skip to content

Detect the PHPUnit runner for MediaWiki 1.46+#77

Merged
malberts merged 2 commits into
masterfrom
ci/phpunit-mw-master
Jun 11, 2026
Merged

Detect the PHPUnit runner for MediaWiki 1.46+#77
malberts merged 2 commits into
masterfrom
ci/phpunit-mw-master

Conversation

@malberts

@malberts malberts commented May 21, 2026

Copy link
Copy Markdown
Collaborator

Why

MediaWiki 1.46 removed the bundled tests/phpunit/phpunit.php runner in favour of
composer phpunit:config + vendor/bin/phpunit. The matrix's master row fails on
the old invocation (Could not open input file: tests/phpunit/phpunit.php); it only
looks green because it is continue-on-error.

What

  • Detect the runner instead of gating on the MediaWiki version. If
    tests/phpunit/phpunit.php exists, use it; otherwise drive PHPUnit through
    composer phpunit:config + vendor/bin/phpunit. No per-version bookkeeping as
    newer MediaWiki versions land.
  • Fetch phpunit.xml.template before composer phpunit:config. MediaWiki marks
    it export-ignore, so it is absent from the source-archive tarball the install
    script downloads.
  • Scope the new runner to this extension's Unit suite by path (the set the old
    --testsuite bootstrap-components-unit ran). The Integration tests use
    SemanticMediaWiki 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.
  • Use Scribunto's namespaced LuaEngineTestBase. Scribunto dropped the legacy
    Scribunto_LuaEngineTestBase alias on master; the namespaced class is present on
    every supported MediaWiki (1.43 and up).
  • Add an experimental REL1_46 row so the new runner is exercised on a stable
    release branch as well as master.

Scope and current state

The REL1_43, REL1_44 and REL1_45 rows keep the old runner unchanged and stay
green. The new runner now collects and runs on 1.46 and master instead of failing
at the entry point, but those rows stay experimental and red: this extension's unit
tests rely on the legacy entry point's full-MediaWiki bootstrap and error with
"Premature access to service container" under vendor/bin/phpunit. Making them green
is a separate test-suite modernization (proper MediaWikiIntegrationTestCase usage)
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.

@malberts malberts force-pushed the ci/phpunit-mw-master branch from 7ff9008 to 31def84 Compare May 21, 2026 08:27
@malberts malberts changed the title CI: switch to vendor/bin/phpunit for MediaWiki master CI: switch to vendor/bin/phpunit + MW bootstrap for the whole matrix May 21, 2026
@malberts malberts force-pushed the ci/phpunit-mw-master branch from 31def84 to 9346482 Compare May 21, 2026 08:32
@malberts malberts changed the title CI: switch to vendor/bin/phpunit + MW bootstrap for the whole matrix CI: switch to vendor/bin/phpunit for MediaWiki master May 21, 2026
@malberts malberts force-pushed the ci/phpunit-mw-master branch from 9346482 to 7f6315c Compare May 21, 2026 08:40
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>
@malberts malberts force-pushed the ci/phpunit-mw-master branch from 7f6315c to 7137d31 Compare June 11, 2026 17:49
@malberts malberts changed the title CI: switch to vendor/bin/phpunit for MediaWiki master Detect the PHPUnit runner for MediaWiki 1.46+ Jun 11, 2026
malberts and others added 2 commits June 11, 2026 19:56
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>
@malberts malberts force-pushed the ci/phpunit-mw-master branch from 7137d31 to 4c30fd4 Compare June 11, 2026 17:56
@malberts malberts marked this pull request as ready for review June 11, 2026 20:23
@malberts malberts merged commit fd00fa2 into master Jun 11, 2026
3 of 6 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant