summaryrefslogtreecommitdiff
path: root/www/wiki/extensions/Translate/tests/phpunit/TranslateHooksTest.php
diff options
context:
space:
mode:
Diffstat (limited to 'www/wiki/extensions/Translate/tests/phpunit/TranslateHooksTest.php')
-rw-r--r--www/wiki/extensions/Translate/tests/phpunit/TranslateHooksTest.php38
1 files changed, 19 insertions, 19 deletions
diff --git a/www/wiki/extensions/Translate/tests/phpunit/TranslateHooksTest.php b/www/wiki/extensions/Translate/tests/phpunit/TranslateHooksTest.php
index 95edbea2..c711c557 100644
--- a/www/wiki/extensions/Translate/tests/phpunit/TranslateHooksTest.php
+++ b/www/wiki/extensions/Translate/tests/phpunit/TranslateHooksTest.php
@@ -4,7 +4,7 @@
*
* @file
* @author Niklas Laxström
- * @license GPL-2.0+
+ * @license GPL-2.0-or-later
*/
/**
@@ -16,16 +16,16 @@ class TranslateHooksTest extends MediaWikiLangTestCase {
parent::setUp();
global $wgHooks;
- $this->setMwGlobals( array(
+ $this->setMwGlobals( [
'wgHooks' => $wgHooks,
'wgTranslateDocumentationLanguageCode' => 'qqq',
- 'wgTranslateTranslationServices' => array(),
- 'wgTranslateMessageNamespaces' => array( NS_MEDIAWIKI ),
- ) );
- $wgHooks['TranslatePostInitGroups'] = array( array( $this, 'getTestGroups' ) );
+ 'wgTranslateTranslationServices' => [],
+ 'wgTranslateMessageNamespaces' => [ NS_MEDIAWIKI ],
+ ] );
+ $wgHooks['TranslatePostInitGroups'] = [ [ $this, 'getTestGroups' ] ];
$mg = MessageGroups::singleton();
- $mg->setCache( wfGetCache( 'hash' ) );
+ $mg->setCache( new WANObjectCache( [ 'cache' => wfGetCache( 'hash' ) ] ) );
$mg->recache();
MessageIndex::setInstance( new HashMessageIndex() );
@@ -33,10 +33,10 @@ class TranslateHooksTest extends MediaWikiLangTestCase {
}
public function getTestGroups( &$list ) {
- $messages = array(
+ $messages = [
'ugakey1' => 'value1',
'ugakey2' => 'value2',
- );
+ ];
$list['testgroup'] = new MockWikiMessageGroup( 'testgroup', $messages );
@@ -44,14 +44,14 @@ class TranslateHooksTest extends MediaWikiLangTestCase {
}
public function testPreventCategorization() {
- $user = new MockSuperUser();
+ $user = $this->getTestSysop()->getUser();
$title = Title::makeTitle( NS_MEDIAWIKI, 'ugakey1/fi' );
$wikipage = WikiPage::factory( $title );
$content = ContentHandler::makeContent( '[[Category:Shouldnotbe]]', $title );
$wikipage->doEditContent( $content, __METHOD__, 0, false, $user );
$this->assertEquals(
- array(),
+ [],
$title->getParentCategories(),
'translation of known message'
);
@@ -62,7 +62,7 @@ class TranslateHooksTest extends MediaWikiLangTestCase {
$wikipage->doEditContent( $content, __METHOD__, 0, false, $user );
$this->assertEquals(
- array( 'Category:Shouldbe' => 'MediaWiki:ugakey2/qqq' ),
+ [ 'Category:Shouldbe' => 'MediaWiki:ugakey2/qqq' ],
$title->getParentCategories(),
'message docs'
);
@@ -72,17 +72,17 @@ class TranslateHooksTest extends MediaWikiLangTestCase {
$content = ContentHandler::makeContent( '[[Category:Shouldbealso]]', $title );
$wikipage->doEditContent( $content, __METHOD__, 0, false, $user );
- $this->assertEquals( array(), $title->getParentCategories(), 'unknown message' );
+ $this->assertEquals( [], $title->getParentCategories(), 'unknown message' );
}
public function testSearchProfile() {
- $profiles = array(
- 'files' => array(),
- 'all' => array(),
- 'advanced' => array()
- );
+ $profiles = [
+ 'files' => [],
+ 'all' => [],
+ 'advanced' => []
+ ];
- $expected = array( 'files', 'translation', 'all', 'advanced' );
+ $expected = [ 'files', 'translation', 'all', 'advanced' ];
TranslateHooks::searchProfile( $profiles );