It's possible this is something with my local setup (but I see the same behavior in an experimental patch on CI so I suspect not), but when I run php tests/phpunit/phpunit.php tests/phpunit/includes/MediaWikiServicesTest.php, this class fails on testDefaultServiceInstantiation.
That test is pretty straightforward:
public function testDefaultServiceInstantiation() { // Check all services in the default instance, not a dummy instance! // Note that we instantiate all services here, including any that // were registered by extensions. $services = MediaWikiServices::getInstance(); $names = $services->getServiceNames(); foreach ( $names as $name ) { $this->assertTrue( $services->hasService( $name ) ); $service = $services->getService( $name ); $this->assertIsObject( $service ); } }
The failure I get:
php tests/phpunit/phpunit.php tests/phpunit/includes/MediaWikiServicesTest.php --filter "testDefaultServiceInstantiation" PHPUnit 8.5.21 by Sebastian Bergmann and contributors. E 1 / 1 (100%) Time: 1.63 seconds, Memory: 50.50 MB There was 1 error: 1) MediaWikiServicesTest::testDefaultServiceInstantiation Error: Call to a member function inNamespace() on null /Users/kostajh/src/mediawiki/w/skins/MinervaNeue/includes/ServiceWiring.php:93 /Users/kostajh/src/mediawiki/w/vendor/wikimedia/services/src/ServiceContainer.php:447 /Users/kostajh/src/mediawiki/w/vendor/wikimedia/services/src/ServiceContainer.php:416 /Users/kostajh/src/mediawiki/w/includes/MediaWikiServices.php:291 /Users/kostajh/src/mediawiki/w/tests/phpunit/includes/MediaWikiServicesTest.php:386 /Users/kostajh/src/mediawiki/w/tests/phpunit/MediaWikiIntegrationTestCase.php:456 ERRORS! Tests: 1, Assertions: 9, Errors: 1.
Following the stack trace, it looks like there is no $wgTitle associated with the RequestContext::getMain() call. I suppose that when php tests/phpunit/phpunit.php is run with all test suites, there is some test that accidentally populates $wgTitle? Not sure.
I can fix the error by setting $wgTitle in the run() method in MediaWikiIntegrationTestCase, but maybe there's some other solution I am missing.
I also wonder how many other tests fail when run on their own but that's a task for another day.