X-Git-Url: https://git.heureux-cyclage.org/?a=blobdiff_plain;f=tests%2Fqunit%2Fdata%2FgenerateJqueryMsgData.php;h=5a96dc33567f2d5902c16bcad3e7094d311a17ce;hb=1d95c68977ef49738eb0fc9c3701afe06467fbeb;hp=61ebbf8fc607483a4f4e451067032030281704a8;hpb=0c615d9029cb6e0d65c21f1df5a8a54e197b860a;p=lhc%2Fweb%2Fwiklou.git diff --git a/tests/qunit/data/generateJqueryMsgData.php b/tests/qunit/data/generateJqueryMsgData.php index 61ebbf8fc6..5a96dc3356 100644 --- a/tests/qunit/data/generateJqueryMsgData.php +++ b/tests/qunit/data/generateJqueryMsgData.php @@ -65,22 +65,22 @@ require __DIR__ . '/../../../maintenance/Maintenance.php'; class GenerateJqueryMsgData extends Maintenance { - public static $keyToTestArgs = array( - 'undelete_short' => array( - array( 0 ), - array( 1 ), - array( 2 ), - array( 5 ), - array( 21 ), - array( 101 ) - ), - 'category-subcat-count' => array( - array( 0, 10 ), - array( 1, 1 ), - array( 1, 2 ), - array( 3, 30 ) - ) - ); + public static $keyToTestArgs = [ + 'undelete_short' => [ + [ 0 ], + [ 1 ], + [ 2 ], + [ 5 ], + [ 21 ], + [ 101 ] + ], + 'category-subcat-count' => [ + [ 0, 10 ], + [ 1, 1 ], + [ 1, 2 ], + [ 3, 30 ] + ] + ]; public function __construct() { parent::__construct(); @@ -94,9 +94,9 @@ class GenerateJqueryMsgData extends Maintenance { } private function getMessagesAndTests() { - $messages = array(); - $tests = array(); - foreach ( array( 'en', 'fr', 'ar', 'jp', 'zh' ) as $languageCode ) { + $messages = []; + $tests = []; + foreach ( [ 'en', 'fr', 'ar', 'jp', 'zh' ] as $languageCode ) { foreach ( self::$keyToTestArgs as $key => $testArgs ) { foreach ( $testArgs as $args ) { // Get the raw message, without any transformations. @@ -109,32 +109,31 @@ class GenerateJqueryMsgData extends Maintenance { // fake multiple languages by flattening them together. $langKey = $languageCode . '_' . $key; $messages[$langKey] = $template; - $tests[] = array( - 'name' => $languageCode . ' ' . $key . ' ' . join( ',', $args ), + $tests[] = [ + 'name' => $languageCode . ' ' . $key . ' ' . implode( ',', $args ), 'key' => $langKey, 'args' => $args, 'result' => $result, 'lang' => $languageCode - ); + ]; } } } - return array( $messages, $tests ); + return [ $messages, $tests ]; } private function writeJavascriptFile( $messages, $tests, $dataSpecFile ) { - $phpParserData = array( + $phpParserData = [ 'messages' => $messages, 'tests' => $tests, - ); + ]; $output = "// This file stores the output from the PHP parser for various messages, arguments,\n" . "// languages, and parser modes. Intended for use by a unit test framework by looping\n" . "// through the object and comparing its parser return value with the 'result' property.\n" . '// Last generated with ' . basename( __FILE__ ) . ' at ' . gmdate( 'r' ) . "\n" - // This file will contain unquoted JSON strings as javascript native object literals, - // flip the quotemark convention for this file. + . "//jscs:disable\n" . "\n" . 'mediaWiki.libs.phpParserData = ' . FormatJson::encode( $phpParserData, true ) . ";\n";