summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
Diffstat (limited to 'MLEB/Translate/tests/phpunit/MessageCollectionTest.php')
-rw-r--r--MLEB/Translate/tests/phpunit/MessageCollectionTest.php32
1 files changed, 16 insertions, 16 deletions
diff --git a/MLEB/Translate/tests/phpunit/MessageCollectionTest.php b/MLEB/Translate/tests/phpunit/MessageCollectionTest.php
index 9362f67b..e73eb4ff 100644
--- a/MLEB/Translate/tests/phpunit/MessageCollectionTest.php
+++ b/MLEB/Translate/tests/phpunit/MessageCollectionTest.php
@@ -3,8 +3,7 @@
* Tests for MessageCollection.
* @author Niklas Laxström
* @file
- * @copyright Copyright © 2013, Niklas Laxström
- * @license GPL-2.0+
+ * @license GPL-2.0-or-later
*/
/**
@@ -17,24 +16,25 @@ class MessageCollectionTest extends MediaWikiTestCase {
parent::setUp();
global $wgHooks;
- $this->setMwGlobals( array(
+ $this->setMwGlobals( [
'wgHooks' => $wgHooks,
- 'wgTranslateCC' => array(),
- 'wgTranslateMessageIndex' => array( 'DatabaseMessageIndex' ),
- 'wgTranslateWorkflowStates' => false,
- 'wgTranslateGroupFiles' => array(),
- 'wgTranslateTranslationServices' => array(),
- ) );
- $wgHooks['TranslatePostInitGroups'] = array( array( $this, 'getTestGroups' ) );
- MessageGroups::clearCache();
- MessageIndexRebuildJob::newJob()->run();
+ 'wgTranslateTranslationServices' => [],
+ ] );
+ $wgHooks['TranslatePostInitGroups'] = [ [ $this, 'getTestGroups' ] ];
+
+ $mg = MessageGroups::singleton();
+ $mg->setCache( wfGetCache( 'hash' ) );
+ $mg->recache();
+
+ MessageIndex::setInstance( new HashMessageIndex() );
+ MessageIndex::singleton()->rebuild();
}
public function getTestGroups( &$list ) {
- $messages = array(
+ $messages = [
'translated' => 'bunny',
'untranslated' => 'fanny',
- );
+ ];
$list['test-group'] = new MockWikiMessageGroup( 'test-group', $messages );
return false;
@@ -59,7 +59,7 @@ class MessageCollectionTest extends MediaWikiTestCase {
/** @var TMessage $translated */
$translated = $collection['translated'];
- $this->assertInstanceof( 'TMessage', $translated );
+ $this->assertInstanceOf( 'TMessage', $translated );
$this->assertEquals( 'translated', $translated->key() );
$this->assertEquals( 'bunny', $translated->definition() );
$this->assertEquals( 'pupuliini', $translated->translation() );
@@ -74,7 +74,7 @@ class MessageCollectionTest extends MediaWikiTestCase {
/** @var TMessage $untranslated */
$untranslated = $collection['untranslated'];
- $this->assertInstanceof( 'TMessage', $untranslated );
+ $this->assertInstanceOf( 'TMessage', $untranslated );
$this->assertEquals( null, $untranslated->translation(), 'no translation is null' );
$this->assertEquals( false, $untranslated->getProperty( 'last-translator-text' ) );
$this->assertEquals( false, $untranslated->getProperty( 'last-translator-id' ) );