diff --git a/includes/ServiceWiring.php b/includes/ServiceWiring.php index be3e769fd..d4b5349e7 100644 --- a/includes/ServiceWiring.php +++ b/includes/ServiceWiring.php @@ -4,6 +4,11 @@ namespace MediaWiki\Extension\DiscussionTools; use MediaWiki\MediaWikiServices; +// PHP unit does not understand code coverage for this file +// as the @covers annotation cannot cover a specific file +// This is fully tested in ServiceWiringTest.php +// @codeCoverageIgnoreStart + return [ 'DiscussionTools.CommentParser' => static function ( MediaWikiServices $services ): CommentParser { return new CommentParser( @@ -48,3 +53,5 @@ return [ ); }, ]; + +// @codeCoverageIgnoreEnd diff --git a/tests/phpunit/ServiceWiringTest.php b/tests/phpunit/ServiceWiringTest.php new file mode 100644 index 000000000..b32a542e3 --- /dev/null +++ b/tests/phpunit/ServiceWiringTest.php @@ -0,0 +1,33 @@ +get( $name ); + $this->addToAssertionCount( 1 ); + } + + public function provideService() { + $wiring = require __DIR__ . '/../../includes/ServiceWiring.php'; + foreach ( $wiring as $name => $_ ) { + yield $name => [ $name ]; + } + } +}