From 94dbdb2453d9a43a8782d69d61980ddb6f3645e6 Mon Sep 17 00:00:00 2001 From: Morne Alberts Date: Fri, 12 Jun 2026 10:06:31 +0200 Subject: [PATCH] CI: run the new-runner tests with the integration-test bootstrap MediaWiki 1.46 replaced tests/phpunit/phpunit.php with vendor/bin/phpunit, whose bootstrap decides between unit and integration mode from the test path: a path under "/unit" is treated as unit-only, and in that mode MediaWiki settings and the service container are not loaded. The tests under tests/phpunit/Unit are not strictly unit tests, they construct objects that use MediaWiki services, so under the new runner they all error with "Premature access to service container". Force the integration-test bootstrap with MEDIAWIKI_HAS_INTEGRATION_TESTS so those tests run. This is a temporary workaround; the proper fix is to reclassify the service-using tests as integration tests (MediaWikiIntegrationTestCase, outside the unit path), after which MediaWiki selects the right bootstrap on its own. Co-Authored-By: Claude Opus 4.8 (1M context) --- .github/workflows/ci.yml | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 00605d5..2e8f7bd 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -105,7 +105,8 @@ jobs: wget -q -O phpunit.xml.template "https://raw.githubusercontent.com/wikimedia/mediawiki/${{ matrix.mw }}/phpunit.xml.template" fi composer phpunit:config - vendor/bin/phpunit -c phpunit.xml extensions/BootstrapComponents/tests/phpunit/Unit + # Temporary integration-test workaround; see issue #98. + MEDIAWIKI_HAS_INTEGRATION_TESTS=1 vendor/bin/phpunit -c phpunit.xml extensions/BootstrapComponents/tests/phpunit/Unit fi - if: env.TYPE == 'coverage' @@ -119,7 +120,8 @@ jobs: wget -q -O phpunit.xml.template "https://raw.githubusercontent.com/wikimedia/mediawiki/${{ matrix.mw }}/phpunit.xml.template" fi composer phpunit:config - vendor/bin/phpunit -c phpunit.xml extensions/BootstrapComponents/tests/phpunit/Unit --coverage-clover coverage.clover + # Temporary integration-test workaround; see issue #98. + MEDIAWIKI_HAS_INTEGRATION_TESTS=1 vendor/bin/phpunit -c phpunit.xml extensions/BootstrapComponents/tests/phpunit/Unit --coverage-clover coverage.clover fi - if: env.TYPE == 'coverage'