mediawiki-extensions-Discus.../tests/phpunit/IntegrationTestCase.php
Bartosz Dziewoński a14474ed76 CommentFormatterTest: Set ArticlePath in the test
Tests would fail if your wiki's config was different than this.

Change-Id: I148851a9d7b777f1fad5f17b01b835b0b9384a80
(cherry picked from commit cf9f11167d)
2024-05-11 18:45:49 +02:00

38 lines
1.3 KiB
PHP

<?php
namespace MediaWiki\Extension\DiscussionTools\Tests;
use MediaWiki\MainConfigNames;
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->overrideConfigValues( [
MainConfigNames::NamespaceAliases => $config['wgNamespaceIds'],
MainConfigNames::MetaNamespace => strtr( $config['wgFormattedNamespaces'][NS_PROJECT], ' ', '_' ),
MainConfigNames::MetaNamespaceTalk =>
strtr( $config['wgFormattedNamespaces'][NS_PROJECT_TALK], ' ', '_' ),
// TODO: Move this to $config
MainConfigNames::Localtimezone => $data['localTimezone'],
// Data used for the tests assumes there are no variants for English.
// Language variants are tested using other languages.
MainConfigNames::UsePigLatinVariant => false,
// Consistent defaults for generating canonical URLs
MainConfigNames::Server => 'https://example.org',
MainConfigNames::CanonicalServer => 'https://example.org',
MainConfigNames::ArticlePath => '/wiki/$1',
] + $config );
$this->setUserLang( $config['wgContentLanguage'] );
$this->setContentLang( $config['wgContentLanguage'] );
}
}