Class "Wikibase\Lib\Store\EntityTitleLookup" does not exist.
Closed, ResolvedPublic

Description

Seen on https://integration.wikimedia.org/ci/job/quibble-vendor-mysql-php72-docker/41244/console testing maths...

13:57:42 1) PropertySuggester\ResultBuilderTest::testMergeWithTraditionalSearchResults
13:57:42 Class "Wikibase\Lib\Store\EntityTitleLookup" does not exist.
13:57:42 
13:57:42 2) PropertySuggester\ResultBuilderTest::testCreateResultsArray
13:57:42 Class "Wikibase\Lib\Store\EntityTitleLookup" does not exist.
13:57:42 
13:57:42 3) PropertySuggester\ResultBuilderTest::testValidCovers with data set #0 ('PropertySuggester\ResultBuilderTest', 'testMergeWithTraditionalSearchResults')
13:57:42 Class "Wikibase\Lib\Store\EntityTitleLookup" does not exist.
13:57:42 
13:57:42 4) PropertySuggester\ResultBuilderTest::testValidCovers with data set #1 ('PropertySuggester\ResultBuilderTest', 'testCreateResultsArray')
13:57:42 Class "Wikibase\Lib\Store\EntityTitleLookup" does not exist.
13:57:42 
13:57:42 5) PropertySuggester\ResultBuilderTest::testValidCovers with data set #2 ('PropertySuggester\ResultBuilderTest', 'testValidCovers')
13:57:42 Class "Wikibase\Lib\Store\EntityTitleLookup" does not exist.

Event Timeline

Ladsgroup subscribed.

This is sorta expected, the class indeed exists but it's not registered through extension*.json system so the new unit tests can't pick it up (it's just "PHPUnit unit tests") and not the main tests. I recommend declining this. It's just a warning and it will be resolved once we fully move to PSR-4 and extension.json registration.

We have fully moved to PSR-4 and extension.json registration, and the warning is still there. To reproduce locally:

user@host mediawiki $ vendor/bin/phpunit extensions/PropertySuggester/tests/phpunit/unit/ResultBuilderTest.php
PHPUnit 8.5.8 by Sebastian Bergmann and contributors.

WWW                                                                 3 / 3 (100%)

Time: 74 ms, Memory: 8.00 MB

There were 3 warnings:

1) PropertySuggester\ResultBuilderTest::testMergeWithTraditionalSearchResults
Cannot stub or mock class or interface "Wikibase\Lib\Store\EntityTitleLookup" which does not exist

2) PropertySuggester\ResultBuilderTest::testCreateResultsArray
Cannot stub or mock class or interface "Wikibase\Lib\Store\EntityTitleLookup" which does not exist

3) PropertySuggester\ResultBuilderTest::testValidCovers
Cannot stub or mock class or interface "Wikibase\Lib\Store\EntityTitleLookup" which does not exist

WARNINGS!
Tests: 3, Assertions: 0, Warnings: 3.

Isn’t the point that the tests in /unit/ are supposed to be independent of MediaWiki, and therefore it doesn’t matter what we register in extension.json, and the tests can only use libraries they get through composer? And EntityTitleLookup is in Wikibase, not any library.

We have fully moved to PSR-4 and extension.json registration, and the warning is still there. To reproduce locally:

user@host mediawiki $ vendor/bin/phpunit extensions/PropertySuggester/tests/phpunit/unit/ResultBuilderTest.php
PHPUnit 8.5.8 by Sebastian Bergmann and contributors.

WWW                                                                 3 / 3 (100%)

Time: 74 ms, Memory: 8.00 MB

There were 3 warnings:

1) PropertySuggester\ResultBuilderTest::testMergeWithTraditionalSearchResults
Cannot stub or mock class or interface "Wikibase\Lib\Store\EntityTitleLookup" which does not exist

2) PropertySuggester\ResultBuilderTest::testCreateResultsArray
Cannot stub or mock class or interface "Wikibase\Lib\Store\EntityTitleLookup" which does not exist

3) PropertySuggester\ResultBuilderTest::testValidCovers
Cannot stub or mock class or interface "Wikibase\Lib\Store\EntityTitleLookup" which does not exist

WARNINGS!
Tests: 3, Assertions: 0, Warnings: 3.

Yes because the current mediawiki phpunit setup can't understand extension*.json (it only understands extension.json), we might be able to fix that easily though.

Change 619004 had a related patch set uploaded (by Ladsgroup; owner: Ladsgroup):
[mediawiki/core@master] Make phpunit:unit accept extension*.json to populate the classes

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

Change 619004 merged by jenkins-bot:
[mediawiki/core@master] Make phpunit:unit accept extension*.json to populate the classes

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

Change 693657 had a related patch set uploaded (by Reedy; author: Ladsgroup):

[mediawiki/core@REL1_35] Make phpunit:unit accept extension*.json to populate the classes

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

Change 693657 merged by jenkins-bot:

[mediawiki/core@REL1_35] Make phpunit:unit accept extension*.json to populate the classes

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