The test in question overrides stuff RequestContext::getMain(), but then doesn't revert it to the original values. This can cause surprising test failures because the overrides persist in other tests. For instance, r938440 moves MediaWikiTest to the Database group, where OutputPage is, but the two interact badly:
I have no name!@2416b685e2b7:/var/www/html/w$ composer phpunit:entrypoint -- --filter 'MediaWikiTest::testInvalidRedirectingOnSpecialPageWithPersonallyIdentifiableTarget|OutputPageTest::testAddWikiTextAsContentNoTitle' > phpunit '-c' 'tests/phpunit/suite.xml' '--filter' 'MediaWikiTest::testInvalidRedirectingOnSpecialPageWithPersonallyIdentifiableTarget|OutputPageTest::testAddWikiTextAsContentNoTitle' Using PHP 8.1.20 PHPUnit 9.5.28 by Sebastian Bergmann and contributors. .F 2 / 2 (100%) Time: 00:01.045, Memory: 347.51 MB There was 1 failure: 1) OutputPageTest::testAddWikiTextAsContentNoTitle Failed asserting that exception of type "MWException" is thrown. /var/www/html/w/tests/phpunit/MediaWikiIntegrationTestCase.php:527 === Logs generated by test case [objectcache] [debug] MainWANObjectCache using store {class} {"class":"HashBagOStuff"} [GlobalTitleFail] [info] RequestContext::getTitle called with no title set. {"exception":{}} [localisation] [debug] LocalisationCache using store LCStoreNull [] [objectcache] [debug] MainWANObjectCache using store {class} {"class":"HashBagOStuff"} [wfDebug] [debug] ParserFactory: using default preprocessor {"private":false} [localisation] [debug] LocalisationCache::isExpired(en): cache missing, need to make one [] [ContentHandler] [info] Registered handler for wikitext: WikitextContentHandler [] [MessageCache] [debug] MessageCache using store {class} {"class":"HashBagOStuff"} === FAILURES! Tests: 2, Assertions: 3, Failures: 1. Script phpunit handling the phpunit event returned with error code 1 Script @phpunit -c tests/phpunit/suite.xml was called via phpunit:entrypoint
testAddWikiTextAsContentNoTitle verifies that no title is set, but the code in question has a fallback to RequestContext::getMain, and a simple var_dump reveals that when OutputPageTest runs, the global title is still "127.0.0.1/in<valid".