The parser tests framework has a four-phase setup when running parsertests:
1: (once) Initialize a temporary test database
2: (once) Set up various globals / reset services
3: (per-file) Add articles to the test database (depends on language and title codec settings in previous step)
4: (per-test) Final configuration, driven by the options and config settings for a specific test
Afterwards, cleanup runs in reverse order:
4: (per-test) Undo configuration changes and options
3: (per-file) Remove articles from the test database
2: (once) Reset globals and services
1: (once) Tear down the database
There are two different parser test 'runners' -- one is driven by a CLI and provides a large # of helpful debugging tools and ways to render/update failing tests. The other one is driven by the PHPUnit framework as a "suite" of tests, and (at the present) runs the steps like this:
1: (once) Set up the database (in ParserTestTopLevelSuite::setUp())
3: (per-file) Add articles (in ParserTestFileSuite::setUp())
2: (per-test) Set up globals and services (in ParserIntegrationTest::setUp())
4: (per-test) Test-specific setup (in ParserTestRunner::runTest)
Note that because steps 2 and 3 happen in the "wrong" order, the "add Articles" step 3 needs to re-run parts of the "setup globals and services" code in order to properly initialize the namespaces and title codec, and then it cleans up after itself before re-doing this in step 2.
Here's the bug:
The article clean up in step 3 is failing when quibble runs integrated tests with Wikibase installed.
The exception looks like this when stack trace dumping code is added:
18:55:11 ParserTestRunner::cleanupArticles: removing Module:Test 18:55:11 Cleanup error! 18:55:11 #0 /workspace/src/extensions/Wikibase/client/includes/WikibaseClient.php(1188): Wikibase\Client\WikibaseClient->getEntitySourceOfLocalRepo() 18:55:11 #1 /workspace/src/extensions/Wikibase/client/includes/Hooks/UpdateRepoHookHandler.php(81): Wikibase\Client\WikibaseClient->getDatabaseDomainNameOfLocalRepo() 18:55:11 #2 /workspace/src/vendor/wikimedia/object-factory/src/ObjectFactory.php(232): Wikibase\Client\Hooks\UpdateRepoHookHandler::factory() 18:55:11 #3 /workspace/src/vendor/wikimedia/object-factory/src/ObjectFactory.php(150): Wikimedia\ObjectFactory::getObjectFromSpec(Array, Array) 18:55:11 #4 /workspace/src/includes/HookContainer/HookContainer.php(468): Wikimedia\ObjectFactory->createObject(Array) 18:55:11 #5 /workspace/src/includes/HookContainer/HookContainer.php(159): MediaWiki\HookContainer\HookContainer->getHandlers('ArticleDeleteCo...', Array) 18:55:11 #6 /workspace/src/includes/HookContainer/HookRunner.php(729): MediaWiki\HookContainer\HookContainer->run('ArticleDeleteCo...', Array) 18:55:11 #7 /workspace/src/includes/page/WikiPage.php(2936): MediaWiki\HookContainer\HookRunner->onArticleDeleteComplete(Object(WikiPage), Object(User), 'cleaning up', 21, Object(ScribuntoContent), Object(ManualLogEntry), 1) 18:55:11 #8 /workspace/src/tests/parser/ParserTestRunner.php(1650): WikiPage->doDeleteArticleBatched('cleaning up', false, Object(User), Array, 'delete', true) 18:55:11 #9 /workspace/src/tests/phpunit/suites/ParserTestFileSuite.php(60): ParserTestRunner->cleanupArticles(Array) 18:55:11 #10 /workspace/src/tests/phpunit/suites/SuiteEventsTrait.php(28): ParserTestFileSuite->tearDown() 18:55:11 #11 /workspace/src/vendor/phpunit/phpunit/src/Framework/TestSuite.php(601): ParserTestFileSuite->run(Object(PHPUnit\Framework\TestResult))
This exception is silently discarded because it occurs in tearDown code, and the fact that "extra" articles are defined for subsequent parser tests *usually* doesn't have any effect.
But if we attempt to combine steps 2 and 3 in a single setUp / tearDown clause, then the exception thrown prevents the rest of the tearDown from running, which does eventually cause failures.
There's something wrong with the way the ArticleDeleteComplete hook is being run, that's causing an exception when Wikibase is installed. Perhaps wikibase isn't being configured correctly? But I'm at a bit of a loss to figure out why.