Page MenuHomePhabricator

Make PHPUnit dataProvider static in Wikibase tests
Open, Needs TriagePublic

Description

The @dataProvider annotation should be a static function, check and make data provider in the extension static and adjust the usages (More infos at T332865).

Some abstract provider function are also used in other extensions and need some compatibility code.

Initial work was done in e875e0b021d4d727adc57f89f1890eb789dae758

Event Timeline

Note: the vast majority of data providers in Wikibase are named either provideSomething or somethingProvider, so searching for public function provide or public function .*Provider\( should find the majority of functions that haven’t been converted yet. (git grep '@data[pP]rovider' | grep -v -e '@data[pP]rovider provide' -e '@data[pP]rovider .*Provider\b' shows a few dozen other data providers that are named differently; those will have to be checked manually whether they’re static or not, as it can’t be seen from the @dataProvider line.)

Change 924543 had a related patch set uploaded (by Lucas Werkmeister (WMDE); author: Lucas Werkmeister (WMDE)):

[mediawiki/extensions/Wikibase@master] view: Make test data providers static (*Provider)

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

It turns out this task has also (like T337153) had some initial work done already: https://gerrit.wikimedia.org/r/c/mediawiki/extensions/Wikibase/+/921633

@Umherirrender, if you’re going to create a bunch of tasks for various extensions to do the same thing, and also upload changes partially doing that thing to those extensions, can you please attach those changes to those tasks, so that others can actually see the connection?

Change 924548 had a related patch set uploaded (by Lucas Werkmeister (WMDE); author: Lucas Werkmeister (WMDE)):

[mediawiki/extensions/Wikibase@master] client: Make some data providers static (provide*)

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

It turns out this task has also (like T337153) had some initial work done already: https://gerrit.wikimedia.org/r/c/mediawiki/extensions/Wikibase/+/921633

@Umherirrender, if you’re going to create a bunch of tasks for various extensions to do the same thing, and also upload changes partially doing that thing to those extensions, can you please attach those changes to those tasks, so that others can actually see the connection?

My initial work was against T332865 and thus all patch sets are marked with that task. After I have finished the work I have looked which data provider are not converted and opened a task for each extension, in the most task I mention the still open data provider I have found, but for Wikibase there are so much tests with so much data provider and it was not possible and seems not useful to mention all of them. I also have assumed when the task gets worked on the developer starts with a up-to-date local clone and would see the already converted data provider in the code and can go with the non-static ones. I am going to update the other tasks to mention the merged patch set.

Change 924543 merged by jenkins-bot:

[mediawiki/extensions/Wikibase@master] view: Make test data providers static (*Provider)

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

Change 924548 merged by jenkins-bot:

[mediawiki/extensions/Wikibase@master] client: Make some data providers static (provide*)

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

Change 927136 had a related patch set uploaded (by Lucas Werkmeister (WMDE); author: Lucas Werkmeister (WMDE)):

[mediawiki/extensions/Wikibase@master] MediawikiEditEntityTest: Improve data providers

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

Change 927136 merged by jenkins-bot:

[mediawiki/extensions/Wikibase@master] MediawikiEditEntityTest: Improve data providers

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