Page MenuHomePhabricator

EntityHandlerTestCase causes invalid data provider failures under PHPUnit 10
Open, Needs TriagePublic

Description

PHPUnit 10 marks empty data provider as invalid with the text "Empty data set provided by data provider" and count this as errors.

Some implementation of EntityHandlerTestCase seems to provide empty data provider or calling markTestSkipped

There was 3 PHPUnit error:

1) Wikibase\Lexeme\Tests\MediaWiki\Content\LexemeHandlerTest::testGetUndoContent
The data provider specified for Wikibase\Lexeme\Tests\MediaWiki\Content\LexemeHandlerTest::testGetUndoContent is invalid
provideGetUndoContent only works for entities that have labels field

WikibaseLexeme\tests\phpunit\mediawiki\Content\LexemeHandlerTest.php:343

2) Wikibase\Search\Elastic\Tests\ItemHandlerTest::testSerialization
The data provider specified for Wikibase\Search\Elastic\Tests\ItemHandlerTest::testSerialization is invalid
Empty data set provided by data provider

WikibaseCirrusSearch\tests\phpunit\ItemHandlerTest.php:189

3) Wikibase\Search\Elastic\Tests\PropertyHandlerTest::testSerialization
The data provider specified for Wikibase\Search\Elastic\Tests\PropertyHandlerTest::testSerialization is invalid
Empty data set provided by data provider

WikibaseCirrusSearch\tests\phpunit\PropertyHandlerTest.php:189
  • WikibaseLexeme\tests\phpunit\mediawiki\Content\LexemeHandlerTest.php
  • WikibaseCirrusSearch\tests\phpunit\ItemHandlerTest.php (done)
  • WikibaseCirrusSearch\tests\phpunit\PropertyHandlerTest.php (done)

Event Timeline

Change #1270473 had a related patch set uploaded (by DCausse; author: DCausse):

[mediawiki/extensions/WikibaseCirrusSearch@master] ItemHandlerTest: do not return empty array from contentProvider

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

Change #1270473 merged by jenkins-bot:

[mediawiki/extensions/WikibaseCirrusSearch@master] Property and ItemHandlerTest: do not return empty array from contentProvider

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

dcausse removed the point value 1 for this task.
dcausse subscribed.

Applied a quick workaround in WikibaseCirrusSearch test case, briefly looked over WikibaseLexeme but was unsure about what to do. I think the current design of EntityHandlerTestCase is not flexible enough and assumes that all subclasses have to run all the tests, it seems to me that an approach around composition with traits might be more appropriate but it sounds like a non trivial refactoring.