aboutsummaryrefslogtreecommitdiffstats
path: root/tests/phpunit/MediaWikiLangTestCase.php
diff options
context:
space:
mode:
authorAryeh Gregor <ayg@aryeh.name>2018-07-29 15:24:54 +0300
committerKunal Mehta <legoktm@member.fsf.org>2018-08-11 22:44:29 -0600
commit90d4f56fe46140f9e97e2fa72698f98b57447fe5 (patch)
treeaafd71518a89d31a647ae7d4340f1003bc33d3a0 /tests/phpunit/MediaWikiLangTestCase.php
parent8f8851325ece1be57c7cd896db7f65b34fee7a88 (diff)
downloadmediawikicore-90d4f56fe46140f9e97e2fa72698f98b57447fe5.tar.gz
mediawikicore-90d4f56fe46140f9e97e2fa72698f98b57447fe5.zip
Mass conversion of $wgContLang to service
Brought to you by vim macros. Bug: T200246 Change-Id: I79e919f4553e3bd3eb714073fed7a43051b4fb2a
Diffstat (limited to 'tests/phpunit/MediaWikiLangTestCase.php')
-rw-r--r--tests/phpunit/MediaWikiLangTestCase.php11
1 files changed, 7 insertions, 4 deletions
diff --git a/tests/phpunit/MediaWikiLangTestCase.php b/tests/phpunit/MediaWikiLangTestCase.php
index fd308b2d9584..4b0edb13f18d 100644
--- a/tests/phpunit/MediaWikiLangTestCase.php
+++ b/tests/phpunit/MediaWikiLangTestCase.php
@@ -1,16 +1,19 @@
<?php
+use MediaWiki\MediaWikiServices;
+
/**
* Base class that store and restore the Language objects
*/
abstract class MediaWikiLangTestCase extends MediaWikiTestCase {
protected function setUp() {
- global $wgLanguageCode, $wgContLang;
+ global $wgLanguageCode;
- if ( $wgLanguageCode != $wgContLang->getCode() ) {
+ $contLang = MediaWikiServices::getInstance()->getContentLanguage();
+ if ( $wgLanguageCode != $contLang->getCode() ) {
throw new MWException( "Error in MediaWikiLangTestCase::setUp(): " .
- "\$wgLanguageCode ('$wgLanguageCode') is different from " .
- "\$wgContLang->getCode() (" . $wgContLang->getCode() . ")" );
+ "\$wgLanguageCode ('$wgLanguageCode') is different from content language code (" .
+ $contLang->getCode() . ")" );
}
parent::setUp();