mirror of
https://gerrit.wikimedia.org/r/mediawiki/extensions/Echo
synced 2024-09-24 02:39:33 +00:00
Merge "Reset the TitleParser service without messing up the database"
This commit is contained in:
commit
45a5c43e78
|
@ -323,14 +323,20 @@ class EchoDiscussionParserTest extends MediaWikiTestCase {
|
||||||
// Since we reset the $wgContLang global, reset the TitleParser service
|
// Since we reset the $wgContLang global, reset the TitleParser service
|
||||||
$services = MediaWikiServices::getInstance();
|
$services = MediaWikiServices::getInstance();
|
||||||
if ( is_callable( [ $services, 'getTitleParser' ] ) ) {
|
if ( is_callable( [ $services, 'getTitleParser' ] ) ) {
|
||||||
$this->setService(
|
// TODO: All of this should use $this->setService()
|
||||||
'TitleParser',
|
$services->resetServiceForTesting( 'TitleParser' );
|
||||||
new MediaWikiTitleCodec(
|
$services->redefineService( 'TitleParser', function () use ( $langObj ) {
|
||||||
|
global $wgLocalInterwikis;
|
||||||
|
return new MediaWikiTitleCodec(
|
||||||
$langObj,
|
$langObj,
|
||||||
new GenderCache(),
|
new GenderCache(),
|
||||||
$services->getMainConfig()->get( 'LocalInterwikis' )
|
$wgLocalInterwikis
|
||||||
)
|
);
|
||||||
);
|
} );
|
||||||
|
// Cleanup
|
||||||
|
$lock = new ScopedCallback( function() use ( $services ) {
|
||||||
|
$services->resetServiceForTesting( 'TitleParser' );
|
||||||
|
} );
|
||||||
}
|
}
|
||||||
|
|
||||||
// pages to be created: templates may be used to ping users (e.g.
|
// pages to be created: templates may be used to ping users (e.g.
|
||||||
|
|
Loading…
Reference in a new issue