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 raised the priority of this task from to Needs Triage.
Amire80 updated the task description. (Show Details)
Amire80 added subscribers: Amire80, Nikerabbit.

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

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!)