Skip to content

CI: switch to vendor/bin/phpunit for MediaWiki master#77

Draft
malberts wants to merge 1 commit into
masterfrom
ci/phpunit-mw-master
Draft

CI: switch to vendor/bin/phpunit for MediaWiki master#77
malberts wants to merge 1 commit into
masterfrom
ci/phpunit-mw-master

Conversation

@malberts
Copy link
Copy Markdown
Collaborator

@malberts malberts commented May 21, 2026

Why

MediaWiki master (≥ 1.46) removed the bundled tests/phpunit/phpunit.php runner. The master matrix entry has been failing with:

Could not open input file: tests/phpunit/phpunit.php

It's been hidden behind experimental: true / continue-on-error: true, but it's red on every PR (e.g. #75).

What

Drive the master matrix entry through the supported new flow:

composer phpunit:config
vendor/bin/phpunit -c extensions/BootstrapComponents/phpunit.xml.dist \
    --bootstrap tests/phpunit/bootstrap.php \
    --testsuite bootstrap-components-unit

Three pieces:

  1. composer phpunit:config (introduced on master) generates the runner-side phpunit.xml from phpunit.xml.template in the MediaWiki root.
  2. vendor/bin/phpunit -c extensions/BootstrapComponents/phpunit.xml.dist keeps using this extension's own testsuite definitions (bootstrap-components-unit).
  3. --bootstrap tests/phpunit/bootstrap.php runs MediaWiki's own bootstrap before discovery so ExtensionRegistry (used by BC's tests/bootstrap.php) is available.

Supporting changes:

  • installWiki.sh: switch from wget tarball to git clone --depth 1. MediaWiki's .gitattributes marks phpunit.xml.template as export-ignore, so GitHub's source-archive tarball doesn't ship it. git clone does. Benchmarked locally — wall-clock is the same (~7–9 s either way), and the cached mediawiki/ tree grows by ~40 MB for the retained .git/ directory (immaterial on GH runners).
  • Bump mw_${{ matrix.mw }}-php${{ matrix.php }} cache key to -v2 so existing caches populated by the old wget path don't shadow the new git-clone install.

The existing two invocations on REL1_39–REL1_43 are gated on matrix.mw != 'master' and otherwise unchanged — so non-master entries' behaviour is preserved.

Verifying

This PR's CI run is the test. Expected outcome: REL1_39–REL1_43 entries stay green, master entry reaches the actual PHPUnit phase (test pass/fail on master itself — including any BC-test-code compatibility with the current Scribunto API — is out of scope for this PR; the goal is to unblock the runner).

🤖 Generated with Claude Code

@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
MediaWiki master (≥ 1.46) removed the bundled `tests/phpunit/phpunit.php`
runner — the master matrix entry was failing with
"Could not open input file: tests/phpunit/phpunit.php".

For the master matrix entry only, drive PHPUnit via:

    composer phpunit:config
    vendor/bin/phpunit -c extensions/BootstrapComponents/phpunit.xml.dist \
        --bootstrap tests/phpunit/bootstrap.php \
        --testsuite bootstrap-components-unit

`composer phpunit:config` (introduced on master) generates the
runner-side phpunit.xml from `phpunit.xml.template`. MW's
`.gitattributes` marks that template as `export-ignore`, so it's
missing from the source-archive tarball that `installWiki.sh` was
fetching with `wget`. Switch `installWiki.sh` to `git clone --depth 1`
so the file ships. Empirically the same wall-clock time (~7-9s either
way over GH-to-GH) and ~40MB extra `.git/` retained in the cached
`mediawiki/` tree.

Bump the `mediawiki/` cache-key suffix to `-v2` so existing caches
populated by the old wget path don't shadow the new git-clone install.

Gate the existing two PHPUnit invocations on `matrix.mw != 'master'`
so REL1_39–REL1_43 keep their working behaviour unchanged.

Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
@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>
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