summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
Diffstat (limited to 'MLEB/Translate/tests/phpunit/api/ApiQueryMessageGroupsTest.php')
-rw-r--r--MLEB/Translate/tests/phpunit/api/ApiQueryMessageGroupsTest.php36
1 files changed, 16 insertions, 20 deletions
diff --git a/MLEB/Translate/tests/phpunit/api/ApiQueryMessageGroupsTest.php b/MLEB/Translate/tests/phpunit/api/ApiQueryMessageGroupsTest.php
index 0a11031a..670c2def 100644
--- a/MLEB/Translate/tests/phpunit/api/ApiQueryMessageGroupsTest.php
+++ b/MLEB/Translate/tests/phpunit/api/ApiQueryMessageGroupsTest.php
@@ -5,11 +5,10 @@
* @file
* @author Harry Burt
* @copyright Copyright © 2012-2013, Harry Burt
- * @license GPL-2.0+
+ * @license GPL-2.0-or-later
*/
/**
- * @group Database
* @group medium
*/
class ApiQueryMessageGroupsTest extends ApiTestCase {
@@ -18,18 +17,15 @@ class ApiQueryMessageGroupsTest extends ApiTestCase {
parent::setUp();
global $wgHooks;
- $this->setMwGlobals( array(
+ $this->setMwGlobals( [
'wgHooks' => $wgHooks,
- 'wgTranslateCC' => array(),
- 'wgTranslateMessageIndex' => array( 'DatabaseMessageIndex' ),
- 'wgTranslateWorkflowStates' => false,
- 'wgTranslateGroupFiles' => array(),
- 'wgEnablePageTranslation' => false,
- '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();
}
public function getTestGroups( &$list ) {
@@ -48,13 +44,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
@@ -90,19 +86,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' ) {
@@ -137,13 +133,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 );