Merge "Reset the TitleParser service without messing up the database"

This commit is contained in:
jenkins-bot 2016-05-11 17:47:01 +00:00 committed by Gerrit Code Review
commit 45a5c43e78

View file

@ -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.