From 40ebea231379d42520f9427c2754ee31b3b3b6d7 Mon Sep 17 00:00:00 2001 From: thiemowmde Date: Mon, 26 Aug 2024 16:57:38 +0200 Subject: [PATCH] Make use of MainConfigNames constants in tests Change-Id: I55aa25268b9d2f48f90b6f79ed4309c9b2355bd9 --- .../Engines/LuaCommon/TitleLibraryTest.php | 27 +++++++++---------- .../Engines/LuaCommon/UriLibraryTest.php | 18 +++++++------ 2 files changed, 23 insertions(+), 22 deletions(-) diff --git a/tests/phpunit/Engines/LuaCommon/TitleLibraryTest.php b/tests/phpunit/Engines/LuaCommon/TitleLibraryTest.php index 95d9842a..6e924442 100644 --- a/tests/phpunit/Engines/LuaCommon/TitleLibraryTest.php +++ b/tests/phpunit/Engines/LuaCommon/TitleLibraryTest.php @@ -3,6 +3,7 @@ namespace MediaWiki\Extension\Scribunto\Tests\Engines\LuaCommon; use MediaWiki\Interwiki\ClassicInterwikiLookup; +use MediaWiki\MainConfigNames; use MediaWiki\Page\PageIdentityValue; use MediaWiki\Parser\ParserOutputFlags; use MediaWiki\Permissions\RestrictionStore; @@ -29,20 +30,18 @@ class TitleLibraryTest extends LuaEngineTestBase { // Set up interwikis (via wgInterwikiCache) before creating any Titles $this->overrideConfigValues( [ - 'Server' => '//wiki.local', - 'CanonicalServer' => 'http://wiki.local', - 'UsePathInfo' => true, - 'ActionPaths' => [], - 'Script' => '/w/index.php', - 'ScriptPath' => '/w', - 'ArticlePath' => '/wiki/$1', - 'InterwikiCache' => ClassicInterwikiLookup::buildCdbHash( [ - [ - 'iw_prefix' => 'interwikiprefix', - 'iw_url' => '//test.wikipedia.org/wiki/$1', - 'iw_local' => 0, - ], - ] ), + MainConfigNames::Server => '//wiki.local', + MainConfigNames::CanonicalServer => 'http://wiki.local', + MainConfigNames::UsePathInfo => true, + MainConfigNames::ActionPaths => [], + MainConfigNames::Script => '/w/index.php', + MainConfigNames::ScriptPath => '/w', + MainConfigNames::ArticlePath => '/wiki/$1', + MainConfigNames::InterwikiCache => ClassicInterwikiLookup::buildCdbHash( [ [ + 'iw_prefix' => 'interwikiprefix', + 'iw_url' => '//test.wikipedia.org/wiki/$1', + 'iw_local' => 0, + ] ] ), ] ); $editor = self::getTestSysop()->getUser(); diff --git a/tests/phpunit/Engines/LuaCommon/UriLibraryTest.php b/tests/phpunit/Engines/LuaCommon/UriLibraryTest.php index 78921454..ded2c3be 100644 --- a/tests/phpunit/Engines/LuaCommon/UriLibraryTest.php +++ b/tests/phpunit/Engines/LuaCommon/UriLibraryTest.php @@ -2,6 +2,8 @@ namespace MediaWiki\Extension\Scribunto\Tests\Engines\LuaCommon; +use MediaWiki\MainConfigNames; + /** * @covers \MediaWiki\Extension\Scribunto\Engines\LuaCommon\UriLibrary */ @@ -13,14 +15,14 @@ class UriLibraryTest extends LuaEngineTestBase { parent::setUp(); $this->overrideConfigValues( [ - 'Server' => '//wiki.local', - 'CanonicalServer' => 'http://wiki.local', - 'UsePathInfo' => true, - 'ActionPaths' => [], - 'Script' => '/w/index.php', - 'ScriptPath' => '/w', - 'ArticlePath' => '/wiki/$1', - 'FragmentMode' => [ 'legacy', 'html5' ], + MainConfigNames::Server => '//wiki.local', + MainConfigNames::CanonicalServer => 'http://wiki.local', + MainConfigNames::UsePathInfo => true, + MainConfigNames::ActionPaths => [], + MainConfigNames::Script => '/w/index.php', + MainConfigNames::ScriptPath => '/w', + MainConfigNames::ArticlePath => '/wiki/$1', + MainConfigNames::FragmentMode => [ 'legacy', 'html5' ], ] ); }