Merge "Handle proxy-based TLS when placed in front of Swift"
[lhc/web/wiklou.git] / tests / phpunit / includes / logging / LogFormatterTest.php
index a21a3ff..1ef3df6 100644 (file)
@@ -4,6 +4,7 @@
  * @group Database
  */
 class LogFormatterTest extends MediaWikiLangTestCase {
+       private static $oldExtMsgFiles;
 
        /**
         * @var User
@@ -30,21 +31,33 @@ class LogFormatterTest extends MediaWikiLangTestCase {
         */
        protected $user_comment;
 
+       public static function setUpBeforeClass() {
+               parent::setUpBeforeClass();
+
+               global $wgExtensionMessagesFiles;
+               self::$oldExtMsgFiles = $wgExtensionMessagesFiles;
+               $wgExtensionMessagesFiles['LogTests'] = __DIR__ . '/LogTests.i18n.php';
+               Language::getLocalisationCache()->recache( 'en' );
+       }
+
+       public static function tearDownAfterClass() {
+               global $wgExtensionMessagesFiles;
+               $wgExtensionMessagesFiles = self::$oldExtMsgFiles;
+               Language::getLocalisationCache()->recache( 'en' );
+
+               parent::tearDownAfterClass();
+       }
+
        protected function setUp() {
                parent::setUp();
 
-               global $wgLang;
-
                $this->setMwGlobals( [
                        'wgLogTypes' => [ 'phpunit' ],
                        'wgLogActionsHandlers' => [ 'phpunit/test' => 'LogFormatter',
                                'phpunit/param' => 'LogFormatter' ],
                        'wgUser' => User::newFromName( 'Testuser' ),
-                       'wgExtensionMessagesFiles' => [ 'LogTests' => __DIR__ . '/LogTests.i18n.php' ],
                ] );
 
-               Language::getLocalisationCache()->recache( $wgLang->getCode() );
-
                $this->user = User::newFromName( 'Testuser' );
                $this->title = Title::newFromText( 'SomeTitle' );
                $this->target = Title::newFromText( 'TestTarget' );
@@ -52,18 +65,11 @@ class LogFormatterTest extends MediaWikiLangTestCase {
                $this->context = new RequestContext();
                $this->context->setUser( $this->user );
                $this->context->setTitle( $this->title );
-               $this->context->setLanguage( $wgLang );
+               $this->context->setLanguage( RequestContext::getMain()->getLanguage() );
 
                $this->user_comment = '<User comment about action>';
        }
 
-       protected function tearDown() {
-               parent::tearDown();
-
-               global $wgLang;
-               Language::getLocalisationCache()->recache( $wgLang->getCode() );
-       }
-
        public function newLogEntry( $action, $params ) {
                $logEntry = new ManualLogEntry( 'phpunit', $action );
                $logEntry->setPerformer( $this->user );
@@ -309,7 +315,7 @@ class LogFormatterTest extends MediaWikiLangTestCase {
 
        /**
         * The testIrcMsgForAction* tests are supposed to cover the hacky
-        * LogFormatter::getIRCActionText / bug 34508
+        * LogFormatter::getIRCActionText / T36508
         *
         * Third parties bots listen to those messages. They are clever enough
         * to fetch the i18n messages from the wiki and then analyze the IRC feed