Page MenuHomePhabricator

Move test cases for grammar forms from JS and PHP to common data files
Open, Needs TriagePublic

Description

Core MediaWiki has code for simple grammar transformations for cases, which should be more data-driven and common to PHP and JS (see T115217).

In particular, since the logic is supposed to be the same in PHP and Js, so should be the tests. Currently they have to be implemented separately as PHP and JS code, which makes adding new rules very uncomfortable. In fact, as of this writing, the test cases are not in sync, which is definitely an issue.

These tests should be moved to a separate data file (probably JSON). The data is there already in mediawiki.language.test.js, so it needs to be moved from that JS file to JSON with changes for JSON syntax, and the missing rules from the PHP tests must be added. That's the easy part.

The (somewhat) harder part is making it loadable in phpunit and Qunit tests. It's probably easy to just read the files in PHP, but I couldn't find a way to load such files to Qunit tests; it will probably require a new kind of ResourceLoader module (but it's quite possible that I didn't look well enough).

This should also make it possible to run these unit tests in CI for all the languages rather than only English.

Event Timeline

Amire80 created this task.Oct 11 2015, 6:09 PM
Amire80 raised the priority of this task from to Needs Triage.
Amire80 updated the task description. (Show Details)
Amire80 added subscribers: Amire80, Nikerabbit.
Restricted Application added a subscriber: Aklapper. · View Herald TranscriptOct 11 2015, 6:09 PM
Restricted Application added a subscriber: StudiesWorld. · View Herald TranscriptNov 12 2015, 10:43 PM

Removing from ResourceLoader workboard as this is not related to the framework in general. Individual modules fall under their respective MediaWiki-* components.

Krinkle removed a subscriber: Krinkle.Apr 21 2016, 11:19 PM
Krinkle moved this task from Inbox to QUnit on the MediaWiki-Core-Testing board.Jul 7 2017, 5:28 AM
Amire80 moved this task from Untriaged to Grammar on the I18n board.Mar 1 2018, 4:16 PM
Aklapper removed Amire80 as the assignee of this task.Jun 19 2020, 4:16 PM

This task has been assigned to the same task owner for more than two years. Resetting task assignee due to inactivity, to decrease task cookie-licking and to get a slightly more realistic overview of plans. Please feel free to assign this task to yourself again if you still realistically work or plan to work on this task - it would be welcome!

For tips how to manage individual work in Phabricator (noisy notifications, lists of task, etc.), see https://phabricator.wikimedia.org/T228575#6237124 for available options.
(For the records, two emails were sent to assignee addresses before resetting assignees. See T228575 for more info and for potential feedback. Thanks!)