tests: Make use of overrideConfig(Value|Values) where needed
As we slowly move away from using globals, overrideConfigValue() and overrideConfigValues() were introduced as a way to override test configs between tests. Under the hood, it just calls setMwGlobals() which resets services, so take note. Part 1: Directories covered are: languages/, maintenance/, tests/, structure/ and includes/Permissions/. Depends-On: I618b16c6d99c94eb2e7edcf05e888a65f7156754 Change-Id: If56f7d10d79f3a9824a52091a2b544d8653dd7b6
This commit is contained in:
parent
b10c2c984a
commit
f00cd03580
10 changed files with 88 additions and 80 deletions
|
|
@ -1325,9 +1325,9 @@ abstract class MediaWikiIntegrationTestCase extends PHPUnit\Framework\TestCase {
|
|||
if ( $lang instanceof Language ) {
|
||||
// Set to the exact object requested
|
||||
$this->setService( 'ContentLanguage', $lang );
|
||||
$this->setMwGlobals( 'wgLanguageCode', $lang->getCode() );
|
||||
$this->overrideConfigValue( MainConfigNames::LanguageCode, $lang->getCode() );
|
||||
} else {
|
||||
$this->setMwGlobals( 'wgLanguageCode', $lang );
|
||||
$this->overrideConfigValue( MainConfigNames::LanguageCode, $lang );
|
||||
}
|
||||
}
|
||||
|
||||
|
|
@ -1348,20 +1348,20 @@ abstract class MediaWikiIntegrationTestCase extends PHPUnit\Framework\TestCase {
|
|||
* @param mixed|null $newValue
|
||||
*/
|
||||
public function setGroupPermissions( $newPerms, $newKey = null, $newValue = null ) {
|
||||
global $wgGroupPermissions;
|
||||
|
||||
if ( is_string( $newPerms ) ) {
|
||||
$newPerms = [ $newPerms => [ $newKey => $newValue ] ];
|
||||
}
|
||||
|
||||
$newPermissions = $wgGroupPermissions;
|
||||
$newPermissions = $this->getServiceContainer()->getMainConfig()
|
||||
->get( MainConfigNames::GroupPermissions );
|
||||
|
||||
foreach ( $newPerms as $group => $permissions ) {
|
||||
foreach ( $permissions as $key => $value ) {
|
||||
$newPermissions[$group][$key] = $value;
|
||||
}
|
||||
}
|
||||
|
||||
$this->setMwGlobals( 'wgGroupPermissions', $newPermissions );
|
||||
$this->overrideConfigValue( MainConfigNames::GroupPermissions, $newPermissions );
|
||||
}
|
||||
|
||||
/**
|
||||
|
|
|
|||
|
|
@ -11,6 +11,7 @@ use MediaWiki\Block\Restriction\NamespaceRestriction;
|
|||
use MediaWiki\Block\Restriction\PageRestriction;
|
||||
use MediaWiki\Block\SystemBlock;
|
||||
use MediaWiki\Cache\CacheKeyHelper;
|
||||
use MediaWiki\MainConfigNames;
|
||||
use MediaWiki\Permissions\PermissionManager;
|
||||
use MediaWiki\Revision\MutableRevisionRecord;
|
||||
use MediaWiki\Session\SessionId;
|
||||
|
|
@ -55,18 +56,15 @@ class PermissionManagerTest extends MediaWikiLangTestCase {
|
|||
$localZone = 'UTC';
|
||||
$localOffset = date( 'Z' ) / 60;
|
||||
|
||||
$this->setMwGlobals( [
|
||||
'wgLocaltimezone' => $localZone,
|
||||
'wgLocalTZoffset' => $localOffset,
|
||||
'wgNamespaceProtection' => [
|
||||
NS_MEDIAWIKI => 'editinterface',
|
||||
],
|
||||
'wgRevokePermissions' => [
|
||||
$this->overrideConfigValues( [
|
||||
MainConfigNames::Localtimezone => $localZone,
|
||||
MainConfigNames::LocalTZoffset => $localOffset,
|
||||
MainConfigNames::RevokePermissions => [
|
||||
'formertesters' => [
|
||||
'runtest' => true
|
||||
]
|
||||
],
|
||||
'wgAvailableRights' => [
|
||||
MainConfigNames::AvailableRights => [
|
||||
'test',
|
||||
'runtest',
|
||||
'writetest',
|
||||
|
|
@ -172,6 +170,10 @@ class PermissionManagerTest extends MediaWikiLangTestCase {
|
|||
$this->setTitle( $namespace );
|
||||
|
||||
$this->mergeMwGlobalArrayValue( 'wgNamespaceProtection', $namespaceProtection );
|
||||
$this->overrideConfigValue(
|
||||
'NamespaceProtection',
|
||||
$namespaceProtection + [ NS_MEDIAWIKI => 'editinterface' ]
|
||||
);
|
||||
|
||||
$permissionManager = $this->getServiceContainer()->getPermissionManager();
|
||||
|
||||
|
|
@ -416,8 +418,8 @@ class PermissionManagerTest extends MediaWikiLangTestCase {
|
|||
}
|
||||
|
||||
public function testAutocreatePermissionsHack() {
|
||||
$this->setMwGlobals( [
|
||||
'wgAutoCreateTempUser' => [
|
||||
$this->overrideConfigValues( [
|
||||
MainConfigNames::AutoCreateTempUser => [
|
||||
'enabled' => true,
|
||||
'actions' => [ 'edit' ],
|
||||
'serialProvider' => [ 'type' => 'local' ],
|
||||
|
|
@ -425,7 +427,7 @@ class PermissionManagerTest extends MediaWikiLangTestCase {
|
|||
'matchPattern' => '*Unregistered $1',
|
||||
'genPattern' => '*Unregistered $1'
|
||||
],
|
||||
'wgGroupPermissions' => [
|
||||
MainConfigNames::GroupPermissions => [
|
||||
'*' => [ 'edit' => false ],
|
||||
'user' => [ 'edit' => true, 'createpage' => true ],
|
||||
]
|
||||
|
|
@ -455,9 +457,9 @@ class PermissionManagerTest extends MediaWikiLangTestCase {
|
|||
* @dataProvider provideTestCheckUserBlockActions
|
||||
*/
|
||||
public function testCheckUserBlockActions( $block, $restriction, $expected ) {
|
||||
$this->setMwGlobals( [
|
||||
'wgEmailConfirmToEdit' => false,
|
||||
'wgEnablePartialActionBlocks' => true,
|
||||
$this->overrideConfigValues( [
|
||||
MainConfigNames::EmailConfirmToEdit => false,
|
||||
MainConfigNames::EnablePartialActionBlocks => true,
|
||||
] );
|
||||
|
||||
if ( $restriction ) {
|
||||
|
|
@ -621,9 +623,9 @@ class PermissionManagerTest extends MediaWikiLangTestCase {
|
|||
* @dataProvider provideTestCheckUserBlockMessage
|
||||
*/
|
||||
public function testCheckUserBlockMessage( $blockType, $blockParams, $restriction, $expected ) {
|
||||
$this->setMwGlobals( [
|
||||
'wgEmailConfirmToEdit' => false,
|
||||
] );
|
||||
$this->overrideConfigValue(
|
||||
MainConfigNames::EmailConfirmToEdit, false
|
||||
);
|
||||
$block = new $blockType( array_merge( [
|
||||
'address' => '127.0.8.1',
|
||||
'by' => $this->user,
|
||||
|
|
@ -700,9 +702,9 @@ class PermissionManagerTest extends MediaWikiLangTestCase {
|
|||
* @dataProvider provideTestCheckUserBlockEmailConfirmToEdit
|
||||
*/
|
||||
public function testCheckUserBlockEmailConfirmToEdit( $emailConfirmToEdit, $assertion ) {
|
||||
$this->setMwGlobals( [
|
||||
'wgEmailConfirmToEdit' => $emailConfirmToEdit,
|
||||
'wgEmailAuthentication' => true,
|
||||
$this->overrideConfigValues( [
|
||||
MainConfigNames::EmailConfirmToEdit => $emailConfirmToEdit,
|
||||
MainConfigNames::EmailAuthentication => true,
|
||||
] );
|
||||
|
||||
$this->overrideUserPermissions( $this->user, [
|
||||
|
|
@ -748,11 +750,11 @@ class PermissionManagerTest extends MediaWikiLangTestCase {
|
|||
$tester->method( 'requiresUnblock' )
|
||||
->willReturn( false );
|
||||
|
||||
$this->setMwGlobals( [
|
||||
'wgActions' => [
|
||||
$this->overrideConfigValues( [
|
||||
MainConfigNames::Actions => [
|
||||
'tester' => $tester,
|
||||
],
|
||||
'wgGroupPermissions' => [
|
||||
MainConfigNames::GroupPermissions => [
|
||||
'*' => [
|
||||
'tester' => true,
|
||||
],
|
||||
|
|
@ -820,9 +822,10 @@ class PermissionManagerTest extends MediaWikiLangTestCase {
|
|||
* - 'pageRestrictions': (array|null) If non-empty, page restriction titles for the block.
|
||||
*/
|
||||
public function testIsBlockedFrom( $title, $expect, array $options = [] ) {
|
||||
$this->setMwGlobals( [
|
||||
'wgBlockAllowsUTEdit' => $options['blockAllowsUTEdit'] ?? true,
|
||||
] );
|
||||
$this->overrideConfigValue(
|
||||
MainConfigNames::BlockAllowsUTEdit,
|
||||
$options['blockAllowsUTEdit'] ?? true
|
||||
);
|
||||
|
||||
$user = $this->getTestUser()->getUser();
|
||||
|
||||
|
|
@ -1208,8 +1211,8 @@ class PermissionManagerTest extends MediaWikiLangTestCase {
|
|||
* @dataProvider provideGetRestrictionLevels
|
||||
*/
|
||||
public function testGetRestrictionLevels( array $expected, $ns, array $userGroups = null ) {
|
||||
$this->setMwGlobals( [
|
||||
'wgGroupPermissions' => [
|
||||
$this->overrideConfigValues( [
|
||||
MainConfigNames::GroupPermissions => [
|
||||
'*' => [ 'edit' => true ],
|
||||
'autoconfirmed' => [ 'editsemiprotected' => true ],
|
||||
'sysop' => [
|
||||
|
|
@ -1218,16 +1221,16 @@ class PermissionManagerTest extends MediaWikiLangTestCase {
|
|||
],
|
||||
'privileged' => [ 'privileged' => true ],
|
||||
],
|
||||
'wgRevokePermissions' => [
|
||||
MainConfigNames::RevokePermissions => [
|
||||
'noeditsemiprotected' => [ 'editsemiprotected' => true ],
|
||||
],
|
||||
'wgNamespaceProtection' => [
|
||||
MainConfigNames::NamespaceProtection => [
|
||||
NS_MAIN => 'autoconfirmed',
|
||||
NS_USER => 'sysop',
|
||||
101 => [ 'editsemiprotected', 'privileged' ],
|
||||
],
|
||||
'wgRestrictionLevels' => [ '', 'autoconfirmed', 'sysop' ],
|
||||
'wgAutopromote' => []
|
||||
MainConfigNames::RestrictionLevels => [ '', 'autoconfirmed', 'sysop' ],
|
||||
MainConfigNames::Autopromote => []
|
||||
] );
|
||||
$user = $userGroups === null ? null : $this->getTestUser( $userGroups )->getUser();
|
||||
$this->assertSame( $expected, $this->getServiceContainer()
|
||||
|
|
@ -1236,9 +1239,7 @@ class PermissionManagerTest extends MediaWikiLangTestCase {
|
|||
}
|
||||
|
||||
public function testGetAllPermissions() {
|
||||
$this->setMwGlobals( [
|
||||
'wgAvailableRights' => [ 'test_right' ]
|
||||
] );
|
||||
$this->overrideConfigValue( MainConfigNames::AvailableRights, [ 'test_right' ] );
|
||||
$this->resetServices();
|
||||
$this->assertContains(
|
||||
'test_right',
|
||||
|
|
@ -1327,10 +1328,10 @@ class PermissionManagerTest extends MediaWikiLangTestCase {
|
|||
* @dataProvider provideWhitelistRead
|
||||
*/
|
||||
public function testWhitelistRead( array $whitelist, string $title, bool $shouldAllow ) {
|
||||
$this->setMwGlobals( 'wgWhitelistRead', $whitelist );
|
||||
$this->overrideConfigValue( MainConfigNames::WhitelistRead, $whitelist );
|
||||
$this->setGroupPermissions( '*', 'read', false );
|
||||
|
||||
$this->setMwGlobals( 'wgLanguageCode', 'es' );
|
||||
$this->overrideConfigValue( MainConfigNames::LanguageCode, 'es' );
|
||||
foreach ( [
|
||||
'ContentLanguage',
|
||||
'MainConfig',
|
||||
|
|
|
|||
|
|
@ -1,6 +1,7 @@
|
|||
<?php
|
||||
|
||||
use MediaWiki\Linker\LinkTarget;
|
||||
use MediaWiki\MainConfigNames;
|
||||
use MediaWiki\Page\PageReference;
|
||||
use MediaWiki\Page\PageReferenceValue;
|
||||
|
||||
|
|
@ -28,9 +29,7 @@ class LanguageConverterTest extends MediaWikiLangTestCase {
|
|||
parent::setUp();
|
||||
$this->setContentLang( 'tg' );
|
||||
|
||||
$this->setMwGlobals( [
|
||||
'wgDefaultLanguageVariant' => false,
|
||||
] );
|
||||
$this->overrideConfigValue( MainConfigNames::DefaultLanguageVariant, false );
|
||||
$this->setContextUser( new User );
|
||||
|
||||
$this->lang = $this->createMock( Language::class );
|
||||
|
|
@ -155,9 +154,7 @@ class LanguageConverterTest extends MediaWikiLangTestCase {
|
|||
* @covers LanguageConverter::getPreferredVariant
|
||||
*/
|
||||
public function testGetPreferredVariantDefaultLanguageVariant( $globalVal, $expected ) {
|
||||
global $wgDefaultLanguageVariant;
|
||||
|
||||
$wgDefaultLanguageVariant = $globalVal;
|
||||
$this->overrideConfigValue( MainConfigNames::DefaultLanguageVariant, $globalVal );
|
||||
$this->assertEquals( $expected, $this->lc->getPreferredVariant() );
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -1,6 +1,7 @@
|
|||
<?php
|
||||
|
||||
use MediaWiki\Languages\LanguageFallback;
|
||||
use MediaWiki\MainConfigNames;
|
||||
|
||||
/**
|
||||
* @group Language
|
||||
|
|
@ -13,7 +14,7 @@ class LanguageFallbackStaticMethodsTest extends MediaWikiIntegrationTestCase {
|
|||
|
||||
private function getCallee( array $options = [] ) {
|
||||
if ( isset( $options['siteLangCode'] ) ) {
|
||||
$this->setMwGlobals( 'wgLanguageCode', $options['siteLangCode'] );
|
||||
$this->overrideConfigValue( MainConfigNames::LanguageCode, $options['siteLangCode'] );
|
||||
}
|
||||
if ( isset( $options['fallbackMap'] ) ) {
|
||||
$this->setService( 'LocalisationCache', $this->getMockLocalisationCache(
|
||||
|
|
|
|||
|
|
@ -46,7 +46,7 @@ class LanguageIntegrationTest extends LanguageClassesTestCase {
|
|||
$this->origHooks = $wgHooks;
|
||||
$newHooks = $wgHooks;
|
||||
unset( $newHooks['LanguageGetTranslatedLanguageNames'] );
|
||||
$this->setMwGlobals( 'wgHooks', $newHooks );
|
||||
$this->overrideConfigValue( MainConfigNames::Hooks, $newHooks );
|
||||
}
|
||||
|
||||
/**
|
||||
|
|
@ -1687,7 +1687,7 @@ class LanguageIntegrationTest extends LanguageClassesTestCase {
|
|||
$translateNumerals, $langCode, $number, $noSeparators, $expected
|
||||
) {
|
||||
$this->hideDeprecated( 'Language::formatNum with a non-numeric string' );
|
||||
$this->setMwGlobals( [ 'wgTranslateNumerals' => $translateNumerals ] );
|
||||
$this->overrideConfigValue( MainConfigNames::TranslateNumerals, $translateNumerals );
|
||||
$lang = Language::factory( $langCode );
|
||||
if ( $noSeparators ) {
|
||||
$formattedNum = $lang->formatNumNoSeparators( $number );
|
||||
|
|
@ -1915,7 +1915,7 @@ class LanguageIntegrationTest extends LanguageClassesTestCase {
|
|||
return __DIR__ . '/../data/messages/Messages_' . $code . '.php';
|
||||
} )
|
||||
);
|
||||
$this->setMwGlobals( 'wgNamespaceAliases', [
|
||||
$this->overrideConfigValue( MainConfigNames::NamespaceAliases, [
|
||||
'Mouse' => NS_SPECIAL,
|
||||
] );
|
||||
$this->setService( 'LanguageNameUtils', $langNameUtils );
|
||||
|
|
@ -1976,7 +1976,10 @@ class LanguageIntegrationTest extends LanguageClassesTestCase {
|
|||
public function testUcfirst( $orig, $expected, $desc, $overrides = false ) {
|
||||
$lang = $this->newLanguage();
|
||||
if ( is_array( $overrides ) ) {
|
||||
$this->setMwGlobals( [ 'wgOverrideUcfirstCharacters' => $overrides ] );
|
||||
$this->overrideConfigValue(
|
||||
MainConfigNames::OverrideUcfirstCharacters,
|
||||
$overrides
|
||||
);
|
||||
}
|
||||
$this->assertSame( $expected, $lang->ucfirst( $orig ), $desc );
|
||||
}
|
||||
|
|
@ -2025,7 +2028,7 @@ class LanguageIntegrationTest extends LanguageClassesTestCase {
|
|||
private function assertGetLanguageNames( array $options, $expected, $code, ...$otherArgs ) {
|
||||
if ( $options ) {
|
||||
foreach ( $options as $key => $val ) {
|
||||
$this->setMwGlobals( "wg$key", $val );
|
||||
$this->overrideConfigValue( $key, $val );
|
||||
}
|
||||
$this->resetServices();
|
||||
}
|
||||
|
|
@ -2067,7 +2070,7 @@ class LanguageIntegrationTest extends LanguageClassesTestCase {
|
|||
}
|
||||
|
||||
// We need to restore the extension's hook that we removed.
|
||||
$this->setMwGlobals( 'wgHooks', $this->origHooks );
|
||||
$this->overrideConfigValue( MainConfigNames::Hooks, $this->origHooks );
|
||||
|
||||
// "pal" is an ancient language, which probably will not appear in Names.php, but appears in
|
||||
// CLDR in English
|
||||
|
|
|
|||
|
|
@ -4,6 +4,7 @@ namespace MediaWiki\Tests\Maintenance;
|
|||
|
||||
use CloneDatabase;
|
||||
use DumpBackup;
|
||||
use MediaWiki\MainConfigNames;
|
||||
use MediaWiki\MediaWikiServices;
|
||||
use MediaWikiIntegrationTestCase;
|
||||
use WikiExporter;
|
||||
|
|
@ -118,9 +119,9 @@ class BackupDumperPageTest extends DumpTestCase {
|
|||
|
||||
// Performing the dump. Suppress warnings, since we want to test
|
||||
// accessing broken revision data (page 5).
|
||||
$this->setMwGlobals( 'wgDevelopmentWarnings', false );
|
||||
$this->overrideConfigValue( MainConfigNames::DevelopmentWarnings, false );
|
||||
$dumper->execute();
|
||||
$this->setMwGlobals( 'wgDevelopmentWarnings', true );
|
||||
$this->overrideConfigValue( MainConfigNames::DevelopmentWarnings, true );
|
||||
|
||||
// Checking syntax and schema
|
||||
$this->assertDumpSchema( $tmpFile, $this->getXmlSchemaPath( $schemaVersion ) );
|
||||
|
|
@ -163,9 +164,9 @@ class BackupDumperPageTest extends DumpTestCase {
|
|||
|
||||
// Performing the dump. Suppress warnings, since we want to test
|
||||
// accessing broken revision data (page 5).
|
||||
$this->setMwGlobals( 'wgDevelopmentWarnings', false );
|
||||
$this->overrideConfigValue( MainConfigNames::DevelopmentWarnings, false );
|
||||
$dumper->execute();
|
||||
$this->setMwGlobals( 'wgDevelopmentWarnings', true );
|
||||
$this->overrideConfigValue( MainConfigNames::DevelopmentWarnings, true );
|
||||
|
||||
// Checking the dumped data
|
||||
$this->assertDumpSchema( $tmpFile, $this->getXmlSchemaPath( $schemaVersion ) );
|
||||
|
|
@ -200,9 +201,9 @@ class BackupDumperPageTest extends DumpTestCase {
|
|||
|
||||
// Performing the dump. Suppress warnings, since we want to test
|
||||
// accessing broken revision data (page 5).
|
||||
$this->setMwGlobals( 'wgDevelopmentWarnings', false );
|
||||
$this->overrideConfigValue( MainConfigNames::DevelopmentWarnings, false );
|
||||
$dumper->dump( WikiExporter::CURRENT, WikiExporter::STUB );
|
||||
$this->setMwGlobals( 'wgDevelopmentWarnings', true );
|
||||
$this->overrideConfigValue( MainConfigNames::DevelopmentWarnings, true );
|
||||
|
||||
// Checking the dumped data
|
||||
$this->assertDumpSchema( $tmpFile, $this->getXmlSchemaPath( $schemaVersion ) );
|
||||
|
|
@ -238,9 +239,9 @@ class BackupDumperPageTest extends DumpTestCase {
|
|||
|
||||
// Performing the dump. Suppress warnings, since we want to test
|
||||
// accessing broken revision data (page 5).
|
||||
$this->setMwGlobals( 'wgDevelopmentWarnings', false );
|
||||
$this->overrideConfigValue( MainConfigNames::DevelopmentWarnings, false );
|
||||
$dumper->dump( WikiExporter::CURRENT, WikiExporter::STUB );
|
||||
$this->setMwGlobals( 'wgDevelopmentWarnings', true );
|
||||
$this->overrideConfigValue( MainConfigNames::DevelopmentWarnings, true );
|
||||
|
||||
// Checking the dumped data
|
||||
$this->gunzip( $tmpFile );
|
||||
|
|
@ -311,9 +312,9 @@ class BackupDumperPageTest extends DumpTestCase {
|
|||
|
||||
// Performing the dump. Suppress warnings, since we want to test
|
||||
// accessing broken revision data (page 5).
|
||||
$this->setMwGlobals( 'wgDevelopmentWarnings', false );
|
||||
$this->overrideConfigValue( MainConfigNames::DevelopmentWarnings, false );
|
||||
$dumper->dump( WikiExporter::FULL, WikiExporter::STUB );
|
||||
$this->setMwGlobals( 'wgDevelopmentWarnings', true );
|
||||
$this->overrideConfigValue( MainConfigNames::DevelopmentWarnings, true );
|
||||
|
||||
$this->assertTrue( fclose( $dumper->stderr ), "Closing stderr handle" );
|
||||
$this->assertNotEmpty( file_get_contents( $fnameReport ) );
|
||||
|
|
|
|||
|
|
@ -3,6 +3,7 @@
|
|||
namespace MediaWiki\Tests\Maintenance;
|
||||
|
||||
use DumpCategoriesAsRdf;
|
||||
use MediaWiki\MainConfigNames;
|
||||
use MediaWikiLangTestCase;
|
||||
|
||||
/**
|
||||
|
|
@ -54,11 +55,11 @@ class CategoriesRdfTest extends MediaWikiLangTestCase {
|
|||
}
|
||||
|
||||
public function testCategoriesDump() {
|
||||
$this->setMwGlobals( [
|
||||
'wgServer' => 'http://acme.test',
|
||||
'wgCanonicalServer' => 'http://acme.test',
|
||||
'wgArticlePath' => '/wiki/$1',
|
||||
'wgRightsUrl' => 'https://creativecommons.org/licenses/by-sa/3.0/',
|
||||
$this->overrideConfigValues( [
|
||||
MainConfigNames::Server => 'http://acme.test',
|
||||
MainConfigNames::CanonicalServer => 'http://acme.test',
|
||||
MainConfigNames::ArticlePath => '/wiki/$1',
|
||||
MainConfigNames::RightsUrl => 'https://creativecommons.org/licenses/by-sa/3.0/',
|
||||
] );
|
||||
|
||||
$dumpScript =
|
||||
|
|
|
|||
|
|
@ -1,5 +1,6 @@
|
|||
<?php
|
||||
|
||||
use MediaWiki\MainConfigNames;
|
||||
use Wikimedia\Rdbms\IDatabase;
|
||||
use Wikimedia\Timestamp\ConvertibleTimestamp;
|
||||
|
||||
|
|
@ -12,10 +13,10 @@ class CategoryChangesAsRdfTest extends MediaWikiLangTestCase {
|
|||
|
||||
protected function setUp(): void {
|
||||
parent::setUp();
|
||||
$this->setMwGlobals( [
|
||||
'wgServer' => 'http://acme.test',
|
||||
'wgCanonicalServer' => 'http://acme.test',
|
||||
'wgArticlePath' => '/wiki/$1',
|
||||
$this->overrideConfigValues( [
|
||||
MainConfigNames::Server => 'http://acme.test',
|
||||
MainConfigNames::CanonicalServer => 'http://acme.test',
|
||||
MainConfigNames::ArticlePath => '/wiki/$1',
|
||||
] );
|
||||
}
|
||||
|
||||
|
|
@ -264,7 +265,10 @@ class CategoryChangesAsRdfTest extends MediaWikiLangTestCase {
|
|||
}
|
||||
|
||||
public function testCategorization() {
|
||||
$this->setMwGlobals( [ 'wgRCWatchCategoryMembership' => true ] );
|
||||
$this->overrideConfigValue(
|
||||
MainConfigNames::RCWatchCategoryMembership,
|
||||
true
|
||||
);
|
||||
$start = new MWTimestamp( "2020-07-31T10:00:00" );
|
||||
$end = new MWTimestamp( "2020-07-31T10:01:00" );
|
||||
ConvertibleTimestamp::setFakeTime( "2020-07-31T10:00:00" );
|
||||
|
|
|
|||
|
|
@ -72,7 +72,7 @@ class ApiStructureTest extends MediaWikiIntegrationTestCase {
|
|||
$this->getServiceContainer()->getMainConfig(),
|
||||
] ) );
|
||||
foreach ( $globals as $k => $v ) {
|
||||
$this->setMwGlobals( "wg$k", $v );
|
||||
$this->overrideConfigValue( $k, $v );
|
||||
}
|
||||
|
||||
// Fetch module.
|
||||
|
|
|
|||
|
|
@ -115,7 +115,7 @@ class MediaWikiIntegrationTestCaseTest extends MediaWikiIntegrationTestCase {
|
|||
|
||||
$oldSitename = $this->getServiceContainer()->getMainConfig()->get( 'Sitename' );
|
||||
|
||||
$this->overrideConfigValue( 'Sitename', 'TestingSitenameOverride' );
|
||||
$this->overrideConfigValue( MainConfigNames::Sitename, 'TestingSitenameOverride' );
|
||||
$nsInfo2 = $this->getServiceContainer()->getNamespaceInfo();
|
||||
|
||||
$this->overrideConfigValues( [ 'TestDummyConfig4556' => 'TestDummyConfigOverride' ] );
|
||||
|
|
@ -294,7 +294,7 @@ class MediaWikiIntegrationTestCaseTest extends MediaWikiIntegrationTestCase {
|
|||
public function testNullLogger_mutateAndRestore() {
|
||||
// Don't rely on the $wgDebugLogGroups and $wgDebugLogFile settings in
|
||||
// WMF CI to make LEVEL_DEBUG (100) the default. Control this in the test.
|
||||
$this->setMwGlobals( 'wgDebugToolbar', true );
|
||||
$this->overrideConfigValue( MainConfigNames::DebugToolbar, true );
|
||||
|
||||
$logger = LoggerFactory::getInstance( 'tomutate' );
|
||||
// Unwrap from LogCapturingSpi
|
||||
|
|
@ -384,7 +384,7 @@ class MediaWikiIntegrationTestCaseTest extends MediaWikiIntegrationTestCase {
|
|||
$this->assertSame( $lang, $dummy->lang );
|
||||
|
||||
// the actual test: change config, reset services.
|
||||
$this->setMwGlobals( 'wgLanguageCode', 'qqx' );
|
||||
$this->overrideConfigValue( MainConfigNames::LanguageCode, 'qqx' );
|
||||
$this->resetServices();
|
||||
|
||||
// the overridden service instance should still be there
|
||||
|
|
|
|||
Loading…
Reference in a new issue