Page MenuHomePhabricator

Make PHPUnit dataProvider static in CheckUser tests
Closed, ResolvedPublic1 Estimated Story Points

Description

The @dataProvider annotation should be a static function, check and make data provider in the extension, at least:

  • CheckUserUnionSelectQueryBuilderTest with provideNullValue and provideSubQueryFields
  • HooksTest with provideOnAuthManagerLoginAuthenticateAuditNoSave

static and adjust the usages (More infos at T332865).

Initial work was done in 090563ba5442eda424b4716bf234306d639c8a56

Event Timeline

Change 926459 had a related patch set uploaded (by Dreamy Jazz; author: Dreamy Jazz):

[mediawiki/extensions/CheckUser@master] Deal with remaining non-static data providers in phpunit tests

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

Change 926459 abandoned by Dreamy Jazz:

[mediawiki/extensions/CheckUser@master] Deal with remaining non-static data providers in phpunit tests

Reason:

Too many merge conflicts. Will re-create this.

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

Change 941899 had a related patch set uploaded (by Dreamy Jazz; author: Dreamy Jazz):

[mediawiki/extensions/CheckUser@master] Make some of the non-static data providers static

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

Change 941899 merged by jenkins-bot:

[mediawiki/extensions/CheckUser@master] Make some of the non-static data providers static

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

Change 956450 had a related patch set uploaded (by Dreamy Jazz; author: Dreamy Jazz):

[mediawiki/extensions/CheckUser@master] clienthints: Make ::provideIncrementAndCheck static

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

There exist other data providers that are non-static in CheckUser, but they are for the now deprecated union query builder which will be removed soon and need some further work to be fixed. Therefore putting time into fixing those providers is not useful.

Change 956450 merged by jenkins-bot:

[mediawiki/extensions/CheckUser@master] clienthints: Make ::provideIncrementAndCheck static

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

@Dreamy_Jazz anything else to do for this one, or shall we resolve it?

@kostajh there still exists non-static data providers for tests related to the union query builder. However, I plan to remove that and importantly the tests that still rely on non-static data providers in T346044.

I've added T337159 as a subtask as this won't technically be resolved until those tests are fixed. They also are not trivial to fix (as the data providers use $this).

Moving back to Blocked/Stalled while the subtask is still being looked at