mediawiki-extensions-Discus.../tests/phpunit/IntegrationTestCase.php
thiemowmde 8bbbf39bbd Make use of named MainConfigNames::… constants
Also merge setMwGlobals() calls because they are really expensive.

Also utilize the more readable str_contains() and related.

Change-Id: Iebde6aa17c2e366f0c0a98fe13a454f6a06c299b
2023-05-19 12:12:32 +02:00

32 lines
993 B
PHP

<?php
namespace MediaWiki\Extension\DiscussionTools\Tests;
use MediaWikiIntegrationTestCase;
abstract class IntegrationTestCase extends MediaWikiIntegrationTestCase {
use TestUtils;
/**
* Setup the MW environment
*
* @param array $config
* @param array $data
*/
protected function setupEnv( array $config, array $data ): void {
$this->setMwGlobals( [
'wgNamespaceAliases' => $config['wgNamespaceIds'],
'wgMetaNamespace' => strtr( $config['wgFormattedNamespaces'][NS_PROJECT], ' ', '_' ),
'wgMetaNamespaceTalk' => strtr( $config['wgFormattedNamespaces'][NS_PROJECT_TALK], ' ', '_' ),
// TODO: Move this to $config
'wgLocaltimezone' => $data['localTimezone'],
// Data used for the tests assumes there are no variants for English.
// Language variants are tested using other languages.
'wgUsePigLatinVariant' => false,
] + $config );
$this->setUserLang( $config['wgContentLanguage'] );
$this->setContentLang( $config['wgContentLanguage'] );
}
}