Siebrand has uploaded a new change for review.

  https://gerrit.wikimedia.org/r/243160

Change subject: Add tests
......................................................................

Add tests

Fix all issues so tests pass.

Change-Id: I934a9545c275c6a16fab83c52d077dd5b62a7ada
---
M .gitignore
A Gruntfile.js
M composer.json
M messagegroups/FileBasedMessageGroup.php
A package.json
A phpcs.xml
M scripts/plural-comparison.php
7 files changed, 60 insertions(+), 58 deletions(-)


  git pull ssh://gerrit.wikimedia.org:29418/mediawiki/extensions/Translate 
refs/changes/60/243160/1

diff --git a/.gitignore b/.gitignore
index 115b5cd..854a2d2 100644
--- a/.gitignore
+++ b/.gitignore
@@ -1,14 +1,6 @@
-.svn
 *~
-.*.swp
 *.kate-swp
-.classpath
-.idea
-.metadata*
-.project
-.settings
-*.bak
-tests/pagetranslation/*.fail
-composer.lock
-extensions/
-vendor/
+.*.swp
+node_modules/
+/composer.lock
+/vendor/
diff --git a/Gruntfile.js b/Gruntfile.js
new file mode 100644
index 0000000..9c56558
--- /dev/null
+++ b/Gruntfile.js
@@ -0,0 +1,20 @@
+/*jshint node:true */
+module.exports = function ( grunt ) {
+       grunt.loadNpmTasks( 'grunt-banana-checker' );
+       grunt.loadNpmTasks( 'grunt-jsonlint' );
+
+       grunt.initConfig( {
+               banana: {
+                       all: 'i18n/'
+               },
+               jsonlint: {
+                       all: [
+                               '**/*.json',
+                               '!node_modules/**'
+                       ]
+               }
+       } );
+
+       grunt.registerTask( 'test', [ 'jsonlint', 'banana' ] );
+       grunt.registerTask( 'default', 'test' );
+};
diff --git a/composer.json b/composer.json
index 2a1da67..4365e8a 100644
--- a/composer.json
+++ b/composer.json
@@ -1,48 +1,12 @@
 {
-       "name": "mediawiki/translate",
-       "type": "mediawiki-extension",
-       "description": "The only standard solution to translate any kind of 
text with an avant-garde web interface within MediaWiki, including your 
documentation and software",
-       "keywords": [
-               "MediaWiki",
-               "Translation",
-               "l10n",
-               "i18n",
-               "g11n",
-               "m17n",
-               "localization",
-               "internationalization",
-               "translatewiki.net"
-       ],
-       "homepage": "https://www.mediawiki.org/wiki/Extension:Translate";,
-       "license": "GPL-2.0+",
-       "authors": [
-               {
-                       "name": "Niklas Laxström",
-                       "email": "niklas.laxst...@gmail.com",
-                       "role": "Lead nitpicker"
-               },
-               {
-                       "name": "Siebrand Mazeland",
-                       "email": "s.mazel...@xs4all.nl",
-                       "role": "Developer"
-               }
-       ],
-       "support": {
-               "issues": 
"https://phabricator.wikimedia.org/tag/mediawiki-extensions-translate/";,
-               "irc": "irc://irc.freenode.net/mediawiki-i18n",
-               "forum": 
"https://www.mediawiki.org/wiki/Extension_talk:Translate";,
-               "wiki": "https://www.mediawiki.org/wiki/Extension:Translate";
+       "require-dev": {
+               "jakub-onderka/php-parallel-lint": "0.9",
+               "mediawiki/mediawiki-codesniffer": "0.4.0"
        },
-       "require": {
-               "php": ">=5.3.0",
-               "composer/installers": ">=1.0.1",
-               "mediawiki/universal-language-selector": "*"
-       },
-       "suggest": {
-               "mediawiki/babel": "Users can easily indicate their language 
proficiency on their user page",
-               "mediawiki/translation-notifications": "Manage communication 
with translators",
-               "mustangostang/spyc": "More recent version of the bundled spyc 
library",
-               "romaricdrigon/metayaml": "If you want to validate message 
group configurations",
-               "ruflin/elastica": "Support for translation memory and search 
in ElasticSearch"
+       "scripts": {
+               "test": [
+                       "parallel-lint . --exclude vendor",
+                       "phpcs -p -s"
+               ]
        }
 }
diff --git a/messagegroups/FileBasedMessageGroup.php 
b/messagegroups/FileBasedMessageGroup.php
index 0b5c383..a36dfd6 100644
--- a/messagegroups/FileBasedMessageGroup.php
+++ b/messagegroups/FileBasedMessageGroup.php
@@ -110,7 +110,9 @@
         * @since 2014.02 Made public
         */
        public function replaceVariables( $pattern, $code ) {
+               // @codingStandardsIgnoreStart Ignore 
MediaWiki.NamingConventions.ValidGlobalName.wgPrefix
                global $IP, $wgTranslateGroupRoot;
+               // @codingStandardsIgnoreEnd
 
                $variables = array(
                        '%CODE%' => $this->mapCode( $code ),
diff --git a/package.json b/package.json
new file mode 100644
index 0000000..76e8a82
--- /dev/null
+++ b/package.json
@@ -0,0 +1,12 @@
+{
+  "private": true,
+  "scripts": {
+    "test": "grunt test"
+  },
+  "devDependencies": {
+    "grunt": "0.4.5",
+    "grunt-cli": "0.1.13",
+    "grunt-banana-checker": "0.2.2",
+    "grunt-jsonlint": "1.0.4"
+  }
+}
diff --git a/phpcs.xml b/phpcs.xml
new file mode 100644
index 0000000..d81a292
--- /dev/null
+++ b/phpcs.xml
@@ -0,0 +1,8 @@
+<?xml version="1.0"?>
+<ruleset>
+       <rule ref="vendor/mediawiki/mediawiki-codesniffer/MediaWiki"/>
+       <file>.</file>
+       <arg name="extensions" value="php,php5,inc"/>
+       <arg name="encoding" value="utf8"/>
+       <exclude-pattern>vendor</exclude-pattern>
+</ruleset>
diff --git a/scripts/plural-comparison.php b/scripts/plural-comparison.php
index dc41b98..4b6bcd5 100644
--- a/scripts/plural-comparison.php
+++ b/scripts/plural-comparison.php
@@ -13,8 +13,7 @@
 if ( getenv( 'MW_INSTALL_PATH' ) !== false ) {
        $IP = getenv( 'MW_INSTALL_PATH' );
 } else {
-       $dir = __DIR__;
-       $IP = "$dir/../../..";
+       $IP = __DIR__ . "/../../..";
 }
 require_once "$IP/maintenance/Maintenance.php";
 
@@ -129,13 +128,18 @@
        }
 
        public function loadCLDR() {
+               // @codingStandardsIgnoreStart Ignore 
MediaWiki.NamingConventions.ValidGlobalName.wgPrefix
                global $IP;
+               // @codingStandardsIgnoreEnd
 
                return $this->loadPluralFile( "$IP/languages/data/plurals.xml" 
);
        }
 
        public function loadMediaWiki() {
+               // @codingStandardsIgnoreStart Ignore 
MediaWiki.NamingConventions.ValidGlobalName.wgPrefix
                global $IP;
+               // @codingStandardsIgnoreEnd
+
                $rules = $this->loadPluralFile( 
"$IP/languages/data/plurals.xml" );
                $rulesMW = $this->loadPluralFile( 
"$IP/languages/data/plurals-mediawiki.xml" );
 

-- 
To view, visit https://gerrit.wikimedia.org/r/243160
To unsubscribe, visit https://gerrit.wikimedia.org/r/settings

Gerrit-MessageType: newchange
Gerrit-Change-Id: I934a9545c275c6a16fab83c52d077dd5b62a7ada
Gerrit-PatchSet: 1
Gerrit-Project: mediawiki/extensions/Translate
Gerrit-Branch: master
Gerrit-Owner: Siebrand <siebr...@kitano.nl>

_______________________________________________
MediaWiki-commits mailing list
MediaWiki-commits@lists.wikimedia.org
https://lists.wikimedia.org/mailman/listinfo/mediawiki-commits

Reply via email to