mediawiki-extensions-AbuseF.../tests/phpunit/AbuseFilterServicesTest.php
Daimona Eaytoy 3f7fff56e8 Adjust code coverage
-Exclude methods and classes that cannot be meaningfully covered
-Add a simple test for AbuseFilterServices
-Exclude ServiceWiring because there's no way to tell PHPUnit it's
covered

Change-Id: I4c67b0d3fea68c7a3b3cbe01b5608f87e1b492db
2020-11-19 22:40:26 +00:00

34 lines
827 B
PHP

<?php
use MediaWiki\Extension\AbuseFilter\AbuseFilterServices;
/**
* @group Test
* @group AbuseFilter
*/
class AbuseFilterServicesTest extends MediaWikiIntegrationTestCase {
/**
* @covers \MediaWiki\Extension\AbuseFilter\AbuseFilterServices
* @param string $getter
* @dataProvider provideGetters
*/
public function testServiceGetters( string $getter ) {
// Methods are typehinted, so no need to assert
AbuseFilterServices::$getter();
$this->addToAssertionCount( 1 );
}
/**
* @return Generator
*/
public function provideGetters() : Generator {
$clazz = new ReflectionClass( AbuseFilterServices::class );
foreach ( $clazz->getMethods( ReflectionMethod::IS_PUBLIC ) as $method ) {
$name = $method->getName();
if ( strpos( $name, 'get' ) === 0 ) {
yield $name => [ $name ];
}
}
}
}