mirror of
https://gerrit.wikimedia.org/r/mediawiki/extensions/AbuseFilter.git
synced 2024-12-01 17:16:23 +00:00
3f7fff56e8
-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
34 lines
827 B
PHP
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 ];
|
|
}
|
|
}
|
|
}
|
|
}
|