The Wikibase Lib and Client extensions have several PHPUnit tests that reference classes from Repo. While most of those tests auto-disable themselves if Repo is not installed, we’d still like to avoid this. It’s not yet clear how to do this, though.
Description
Details
Status | Subtype | Assigned | Task | ||
---|---|---|---|---|---|
Resolved | Lucas_Werkmeister_WMDE | T255880 Remove uses of PHP classes from Wikibase Repo in Client and Lib | |||
Resolved | Tarrow | T255885 Figure out what to do with uses of Repo classes in Lib and Client tests | |||
Resolved | Tarrow | T257549 Enable API testing for Wikibase |
Event Timeline
I have been thinking about this, I looked at the two tests that have a bad dependency. Both seems to be legitimate cases, I have thought moving them to another component, or moving them to a shared place but couldn't come up with a good solution.
For LuaWikibaseIntegrationTest: I have no idea.
For EntityChangeLookupTest: Move ChangeStore and SqlChangeStore from repo to lib to be next to EntityChangeLookup. For example for term store, we move the write logic to lib while only repo uses the write logic.
Change 609271 had a related patch set uploaded (by Ladsgroup; owner: Ladsgroup):
[mediawiki/extensions/Wikibase@master] Move SqlChangeStore from repo to lib
Change 609271 merged by jenkins-bot:
[mediawiki/extensions/Wikibase@master] Move SqlChangeStore from repo to lib
I looked a bit into LuaWikibaseIntegrationTest and I’m also unsure what to do with that. The test saves an example item to WikibaseRepo’s entity store, creates a test module, and then tests the result of parsing various bits of wikitext that invoke that module.
We could try to remove the dependency on WikibaseRepo by instead overriding WikibaseClient’s services (entity lookup etc.) to return the example item. But then the test becomes pretty similar to other tests, which already install a MockClientStore, and ultimately it’s not really an integration test anymore: it doesn’t test the full connection between Wikibase Repo and Client.
If we say that this is a test which needs the WikibaseRepo extension to be installed, and that’s fine, but we want to avoid the direct coupling to the WikibaseRepo PHP class, then there are other ways to avoid that. We could, for example, save the example item using an API call. Come to think of it, we could also use API calls to create the test module, and to do the various test parses… maybe we can turn this test into a MediaWiki API integration test?
Change 609461 had a related patch set uploaded (by Lucas Werkmeister (WMDE); owner: Lucas Werkmeister (WMDE)):
[mediawiki/extensions/Wikibase@master] Skip SqlChangeStoreTest in Client-only mode
Change 609461 merged by jenkins-bot:
[mediawiki/extensions/Wikibase@master] Skip SqlChangeStoreTest in Client-only mode
I quite like the idea of creating them through API requests, this is coupling to the public interface that's much more stable than the code itself.
Hm, one thing that API integration tests can’t do is this:
$this->setAllowDataAccessInUserLanguage( false );
But I think we should be able to deal with that. I don’t see a lot of other config changes in that test.
Change 609779 had a related patch set uploaded (by Lucas Werkmeister (WMDE); owner: Lucas Werkmeister (WMDE)):
[mediawiki/extensions/Wikibase@master] WIP: API integration test for Lua
Change 612563 had a related patch set uploaded (by Lucas Werkmeister (WMDE); owner: Lucas Werkmeister (WMDE)):
[mediawiki/extensions/Wikibase@master] Use $wgCirrusSearchDisableUpdate in CI config
Change 612564 had a related patch set uploaded (by Lucas Werkmeister (WMDE); owner: Lucas Werkmeister (WMDE)):
[mediawiki/extensions/Wikibase@master] Remove PHP LuaWikibaseIntegrationTest
Change 609779 merged by jenkins-bot:
[mediawiki/extensions/Wikibase@master] Rewrite LuaWikibaseIntegrationTest as API integration test
Change 612563 merged by jenkins-bot:
[mediawiki/extensions/Wikibase@master] Use $wgCirrusSearchDisableUpdate in CI config
Change 612564 merged by jenkins-bot:
[mediawiki/extensions/Wikibase@master] Remove PHP LuaWikibaseIntegrationTest
$ GIT_PAGER=cat git grep -F 'Wikibase\Repo\' lib/ client/ client/includes/Api/PageTerms.php:use Wikibase\Repo\WikibaseRepo;
No more test uses \o/