From 4e1bf213da5861c193f9beb97c24d049636d969d Mon Sep 17 00:00:00 2001 From: Morne Alberts Date: Thu, 11 Jun 2026 19:56:20 +0200 Subject: [PATCH 1/2] CI: detect the PHPUnit runner and add MediaWiki 1.46 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) --- .github/workflows/ci.yml | 30 +++++++++++++++++++++++++----- 1 file changed, 25 insertions(+), 5 deletions(-) diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index a0f15f4..00605d5 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -25,7 +25,7 @@ jobs: php: 8.3 type: normal experimental: false - - mw: 'master' + - mw: 'REL1_46' php: 8.4 type: normal experimental: true @@ -95,12 +95,32 @@ jobs: run: bash EarlyCopy/.github/workflows/uploadImages.sh - if: env.TYPE != 'coverage' - name: Run PHPUnit w/o coverage - run: php tests/phpunit/phpunit.php -c extensions/BootstrapComponents/ --testsuite bootstrap-components-unit + name: Run PHPUnit + run: | + if [ -f tests/phpunit/phpunit.php ]; then + php tests/phpunit/phpunit.php -c extensions/BootstrapComponents/ --testsuite bootstrap-components-unit + else + # MW 1.46 and later + if [ ! -f phpunit.xml.template ]; then + 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 + fi - if: env.TYPE == 'coverage' - name: Run PHPUnit w/ coverage - run: php tests/phpunit/phpunit.php -c extensions/BootstrapComponents/ --testsuite bootstrap-components-unit --coverage-clover coverage.clover + name: Run PHPUnit (coverage) + run: | + if [ -f tests/phpunit/phpunit.php ]; then + php tests/phpunit/phpunit.php -c extensions/BootstrapComponents/ --testsuite bootstrap-components-unit --coverage-clover coverage.clover + else + # MW 1.46 and later + if [ ! -f phpunit.xml.template ]; then + 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 + fi - if: env.TYPE == 'coverage' name: upload coverage report From 4c30fd4d65119fafd9f2d44d949f8efd3d277c7c Mon Sep 17 00:00:00 2001 From: Morne Alberts Date: Thu, 11 Jun 2026 19:56:20 +0200 Subject: [PATCH 2/2] tests: extend Scribunto's namespaced LuaEngineTestBase 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) --- tests/phpunit/Unit/LuaLibraryTestBase.php | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/tests/phpunit/Unit/LuaLibraryTestBase.php b/tests/phpunit/Unit/LuaLibraryTestBase.php index 12a3953..2fcabec 100644 --- a/tests/phpunit/Unit/LuaLibraryTestBase.php +++ b/tests/phpunit/Unit/LuaLibraryTestBase.php @@ -3,7 +3,7 @@ namespace MediaWiki\Extension\BootstrapComponents\Tests\Unit; use MediaWiki\Extension\BootstrapComponents\LuaLibrary; -use Scribunto_LuaEngineTestBase; +use MediaWiki\Extension\Scribunto\Tests\Engines\LuaCommon\LuaEngineTestBase; /** * @ingroup Test @@ -15,7 +15,7 @@ * @since 1.1 * @author Tobias Oetterer */ -abstract class LuaLibraryTestBase extends Scribunto_LuaEngineTestBase +abstract class LuaLibraryTestBase extends LuaEngineTestBase { /** * @var LuaLibrary