* @file
* @ingroup Testing
*/
+use MediaWiki\MediaWikiServices;
/**
* @ingroup Testing
# add a namespace shadowing a interwiki link, to test
# proper precedence when resolving links. (bug 51680)
$wgExtraNamespaces[100] = 'MemoryAlpha';
+ $wgExtraNamespaces[101] = 'MemoryAlpha talk';
// XXX: tests won't run without this (for CACHE_DB)
if ( $wgMainCacheType === CACHE_DB ) {
// "extra language links"
// see https://gerrit.wikimedia.org/r/111390
array_push( $wgExtraInterlanguageLinkPrefixes, 'mul' );
+
+ // Reset namespace cache
+ MWNamespace::getCanonicalNamespaces( true );
+ Language::factory( 'en' )->resetNamespaces();
}
/**
Hooks::clear( 'InterwikiLoadPrefix' );
}
+ /**
+ * Reset the Title-related services that need resetting
+ * for each test
+ */
+ public static function resetTitleServices() {
+ $services = MediaWikiServices::getInstance();
+ $services->resetServiceForTesting( 'TitleFormatter' );
+ $services->resetServiceForTesting( 'TitleParser' );
+ $services->resetServiceForTesting( '_MediaWikiTitleCodec' );
+
+ }
+
public function setupRecorder( $options ) {
if ( isset( $options['record'] ) ) {
$this->recorder = new DbTestRecorder( $this );
$result =
$this->runTest( $t['test'], $t['input'], $t['result'], $t['options'], $t['config'] );
$ok = $ok && $result;
- $this->recorder->record( $t['test'], $result );
+ $this->recorder->record( $t['test'], $t['subtest'], $result );
}
if ( $this->showProgress ) {
$titleText = 'Parser test';
}
+ ObjectCache::getMainWANInstance()->clearProcessCache();
$local = isset( $opts['local'] );
$preprocessor = isset( $opts['preprocessor'] ) ? $opts['preprocessor'] : null;
$parser = $this->getParser( $preprocessor );
'wgExperimentalHtmlIds' => false,
'wgExternalLinkTarget' => false,
'wgHtml5' => true,
- 'wgWellFormedXml' => true,
'wgAdaptiveMessageCache' => true,
'wgDisableLangConversion' => false,
'wgDisableTitleConversion' => false,
MWTidy::destroySingleton();
RepoGroup::destroySingleton();
+ self::resetTitleServices();
+
return $context;
}