Page MenuHomePhabricator

Make PHPUnit dataProvider on UstringLibraryTest and LuaEngineUnitTestBase static
Open, Needs TriagePublic

Description

The @dataProvider annotation should be a static function, make

  • UstringLibraryTest::provideUstringLibraryNormalizationTests
  • abstract LuaEngineTestBase::provideLuaData
  • abstract LuaEngineUnitTestBase::provideLuaData

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

Needs some compatibility code as some other extensions sub class the abstract class.

Initial work was done in 16189b5866e19b7cd6e2ec00b4171c9c1d0ec9a7

Event Timeline

Needs some compatibility code as some other extensions sub class the abstract class.

Though static::$dataProviderClass doesn’t seem to be used anywhere according to codesearch, so the data provider doesn’t need to be quite as flexible as it currently is either (AFAICT).

The data for the data provider are stored in lua files. To access lua files a LuaEngine is needed. To create a LuaEngine some non-static parts of the test case are used/needed, to get engine name or for a template callback.

There is also T358394: Stop using PHPUnit's TestSuite in Scribunto, indicate more parts of the tests needs rewrite. Both tasks blocking PHPUnit 10.

In UstringLibraryTest it is a bit mixed, it is using a data provider object, but the real data are from a file, but it is combined with the data provider object needing a LuaEngine.