summaryrefslogtreecommitdiff
path: root/www/wiki/extensions/Translate/tests/phpunit/api/ApiQueryMessageGroupsTest.php
diff options
context:
space:
mode:
Diffstat (limited to 'www/wiki/extensions/Translate/tests/phpunit/api/ApiQueryMessageGroupsTest.php')
-rw-r--r--www/wiki/extensions/Translate/tests/phpunit/api/ApiQueryMessageGroupsTest.php28
1 files changed, 13 insertions, 15 deletions
diff --git a/www/wiki/extensions/Translate/tests/phpunit/api/ApiQueryMessageGroupsTest.php b/www/wiki/extensions/Translate/tests/phpunit/api/ApiQueryMessageGroupsTest.php
index e4a74771..68265733 100644
--- a/www/wiki/extensions/Translate/tests/phpunit/api/ApiQueryMessageGroupsTest.php
+++ b/www/wiki/extensions/Translate/tests/phpunit/api/ApiQueryMessageGroupsTest.php
@@ -1,11 +1,9 @@
<?php
/**
- * Unit tests for api module.
- *
* @file
* @author Harry Burt
* @copyright Copyright © 2012-2013, Harry Burt
- * @license GPL-2.0+
+ * @license GPL-2.0-or-later
*/
/**
@@ -17,14 +15,14 @@ class ApiQueryMessageGroupsTest extends ApiTestCase {
parent::setUp();
global $wgHooks;
- $this->setMwGlobals( array(
+ $this->setMwGlobals( [
'wgHooks' => $wgHooks,
- 'wgTranslateTranslationServices' => array(),
- ) );
- $wgHooks['TranslatePostInitGroups'] = array( array( $this, 'getTestGroups' ) );
+ 'wgTranslateTranslationServices' => [],
+ ] );
+ $wgHooks['TranslatePostInitGroups'] = [ [ $this, 'getTestGroups' ] ];
$mg = MessageGroups::singleton();
- $mg->setCache( wfGetCache( 'hash' ) );
+ $mg->setCache( new WANObjectCache( [ 'cache' => wfGetCache( 'hash' ) ] ) );
$mg->recache();
}
@@ -44,13 +42,13 @@ class ApiQueryMessageGroupsTest extends ApiTestCase {
public function testAPIAccuracy() {
list( $data ) = $this->doApiRequest(
- array(
+ [
'action' => 'query',
'meta' => 'messagegroups',
'mgprop' => 'id|label|class|namespace|exists',
// @see https://gerrit.wikimedia.org/r/#/c/160222/
'continue' => ''
- )
+ ]
);
// Check structure
@@ -86,19 +84,19 @@ class ApiQueryMessageGroupsTest extends ApiTestCase {
}
public function testAPIFilterAccuracy() {
- $ids = array( 'MadeUpGroup' );
+ $ids = [ 'MadeUpGroup' ];
$ids += array_keys( MessageGroups::getAllGroups() );
foreach ( $ids as $id ) {
list( $data ) = $this->doApiRequest(
- array(
+ [
'action' => 'query',
'meta' => 'messagegroups',
'mgprop' => 'id|label|class|namespace|exists',
'mgfilter' => $id,
// @see https://gerrit.wikimedia.org/r/#/c/160222/
'continue' => ''
- )
+ ]
);
if ( $id === 'MadeUpGroup' ) {
@@ -133,13 +131,13 @@ class ApiQueryMessageGroupsTest extends ApiTestCase {
public function testBadProperty() {
list( $data ) = $this->doApiRequest(
- array(
+ [
'action' => 'query',
'meta' => 'messagegroups',
'mgprop' => 'madeupproperty',
// @see https://gerrit.wikimedia.org/r/#/c/160222/
'continue' => ''
- )
+ ]
);
$this->assertArrayHasKey( 'query', $data );