As a Wikibase developer, I want to run the test suite locally without errors, to see if there’s something wrong with my changes or not.
Problem:
With $wgUseInstantCommons = true in my LocalSettings.php, several tests fail:
1) Wikibase\Repo\Tests\Api\CreateClaimTest::testValidRequest HTTP request blocked: https://commons.wikimedia.org/w/api.php?titles=File%3AFoo.png&iiprop=timestamp%7Cuser%7Ccomment%7Curl%7Csize%7Csha1%7Cmetadata%7Cmime%7Cmediatype%7Cext metadata&prop=imageinfo&iimetadataversion=2&iiextmetadatamultilang=1&format=json&action=query&redirects=true&uselang=en by ForeignAPIRepo::httpGet. Use MockHttpTrait. /var/www/html/wiki1/tests/phpunit/mocks/NullHttpRequestFactory.php:43 /var/www/html/wiki1/includes/http/MWHttpRequest.php:200 /var/www/html/wiki1/includes/filerepo/ForeignAPIRepo.php:531 /var/www/html/wiki1/includes/filerepo/ForeignAPIRepo.php:577 /var/www/html/wiki1/includes/libs/objectcache/wancache/WANObjectCache.php:1558 /var/www/html/wiki1/includes/libs/objectcache/wancache/WANObjectCache.php:1389 /var/www/html/wiki1/includes/filerepo/ForeignAPIRepo.php:587 /var/www/html/wiki1/includes/filerepo/ForeignAPIRepo.php:201 /var/www/html/wiki1/includes/filerepo/file/ForeignAPIFile.php:68 /var/www/html/wiki1/includes/filerepo/FileRepo.php:428 /var/www/html/wiki1/includes/filerepo/ForeignAPIRepo.php:117 /var/www/html/wiki1/includes/filerepo/FileRepo.php:468 /var/www/html/wiki1/includes/filerepo/RepoGroup.php:161 /var/www/html/wiki1/extensions/Wikibase/repo/includes/ParserOutput/ImageLinksDataUpdater.php:82 /var/www/html/wiki1/extensions/Wikibase/repo/includes/ParserOutput/CompositeStatementDataUpdater.php:32 /var/www/html/wiki1/extensions/Wikibase/repo/includes/ParserOutput/ItemParserOutputUpdater.php:31 /var/www/html/wiki1/extensions/Wikibase/repo/includes/ParserOutput/ItemParserOutputUpdater.php:22 /var/www/html/wiki1/extensions/Wikibase/repo/includes/ParserOutput/EntityParserOutputDataUpdaterCollection.php:44 /var/www/html/wiki1/extensions/Wikibase/repo/includes/ParserOutput/FullEntityParserOutputGenerator.php:138 /var/www/html/wiki1/extensions/Wikibase/repo/includes/ParserOutput/StatsdTimeRecordingEntityParserOutputGenerator.php:48 /var/www/html/wiki1/extensions/Wikibase/repo/includes/Content/EntityContent.php:238 /var/www/html/wiki1/extensions/Wikibase/repo/includes/Content/ItemContent.php:234 /var/www/html/wiki1/extensions/Wikibase/repo/includes/Content/EntityContent.php:177 /var/www/html/wiki1/includes/Revision/RenderedRevision.php:263 /var/www/html/wiki1/includes/Revision/RenderedRevision.php:235 /var/www/html/wiki1/includes/Revision/RevisionRenderer.php:215 /var/www/html/wiki1/includes/Revision/RevisionRenderer.php:152 /var/www/html/wiki1/includes/Revision/RenderedRevision.php:197 /var/www/html/wiki1/includes/Storage/DerivedPageDataUpdater.php:1337 /var/www/html/wiki1/includes/Storage/DerivedPageDataUpdater.php:1722 /var/www/html/wiki1/includes/Storage/DerivedPageDataUpdater.php:1474 /var/www/html/wiki1/includes/Storage/PageUpdater.php:1372 /var/www/html/wiki1/includes/libs/rdbms/database/Database.php:4461 /var/www/html/wiki1/includes/libs/rdbms/database/DBConnRef.php:68 /var/www/html/wiki1/includes/libs/rdbms/database/DBConnRef.php:641 /var/www/html/wiki1/includes/deferred/AtomicSectionUpdate.php:39 /var/www/html/wiki1/includes/deferred/DeferredUpdates.php:467 /var/www/html/wiki1/includes/deferred/DeferredUpdates.php:344 /var/www/html/wiki1/includes/deferred/DeferredUpdates.php:278 /var/www/html/wiki1/includes/deferred/DeferredUpdates.php:190 /var/www/html/wiki1/includes/deferred/DeferredUpdates.php:491 /var/www/html/wiki1/includes/deferred/DeferredUpdates.php:131 /var/www/html/wiki1/includes/Storage/PageUpdater.php:1172 /var/www/html/wiki1/includes/Storage/PageUpdater.php:801 /var/www/html/wiki1/extensions/Wikibase/repo/includes/Store/Sql/WikiPageEntityStore.php:374 /var/www/html/wiki1/extensions/Wikibase/repo/includes/Store/Sql/WikiPageEntityStore.php:234 /var/www/html/wiki1/extensions/Wikibase/lib/includes/Store/TypeDispatchingEntityStore.php:85 /var/www/html/wiki1/extensions/Wikibase/repo/includes/EditEntity/StatsdSaveTimeRecordingEntityStore.php:50 /var/www/html/wiki1/extensions/Wikibase/repo/includes/EditEntity/MediawikiEditEntity.php:736 /var/www/html/wiki1/extensions/Wikibase/repo/includes/EditEntity/StatsdSaveTimeRecordingEditEntity.php:74 /var/www/html/wiki1/extensions/Wikibase/repo/includes/Api/EntitySavingHelper.php:365 /var/www/html/wiki1/extensions/Wikibase/repo/includes/Api/CreateClaim.php:138 /var/www/html/wiki1/includes/api/ApiMain.php:1607 /var/www/html/wiki1/includes/api/ApiMain.php:556 /var/www/html/wiki1/tests/phpunit/includes/api/ApiTestCase.php:121 /var/www/html/wiki1/extensions/Wikibase/repo/tests/phpunit/includes/Api/WikibaseApiTestCase.php:104 /var/www/html/wiki1/extensions/Wikibase/repo/tests/phpunit/includes/Api/CreateClaimTest.php:65 /var/www/html/wiki1/tests/phpunit/MediaWikiIntegrationTestCase.php:437 /var/www/html/wiki1/maintenance/doMaintenance.php:106 … 2) Wikibase\Repo\Tests\Api\CreateClaimTest::testCreateClaimWithTag … 3) Wikibase\Repo\Tests\Api\CreateClaimTest::testMultipleRequests … 4) Wikibase\Repo\Tests\Api\GetClaimsTest::testGetInvalidIds with data set #0 (null, 'nopeNopeNope') … 16) Wikibase\Repo\Tests\Api\SetClaimValueTest::testValidRequests … 17) Wikibase\Repo\Tests\Api\SetClaimValueTest::testSetClaimNewWithTag
Workaround:
$wgUseInstantCommons = !defined( 'MW_PHPUNIT_TEST' ); // T268890
Acceptance Criteria🏕️🌟
- The existing tests should pass when $wgUseInstantCommons is false (it should be set to false for the tests)
- Where appropriate new tests should be added with $wgUseInstantCommons true (as will be the case on various other wikibase installations)
- These tests may be at the same level (api tests), or testing some code further down the stack?
- It may also be that when looking at this issue, these tests are not needed?
Notes:
Se MW Integration test case setting for how to change these settings in tests.