Merge "Adjust code coverage"

This commit is contained in:
jenkins-bot 2020-11-20 06:48:12 +00:00 committed by Gerrit Code Review
commit a16cca0ecb
6 changed files with 49 additions and 0 deletions

View file

@ -4,6 +4,9 @@ namespace MediaWiki\Extension\AbuseFilter\Filter;
use RuntimeException;
/**
* @codeCoverageIgnore
*/
class FilterNotFoundException extends RuntimeException {
/**
* @param int $filter

View file

@ -4,6 +4,9 @@ namespace MediaWiki\Extension\AbuseFilter\Filter;
use RuntimeException;
/**
* @codeCoverageIgnore
*/
class FilterVersionNotFoundException extends RuntimeException {
/**
* @param int $version

View file

@ -225,6 +225,7 @@ class FilterProfiler {
* @param int $totalFilters
* @param int $totalConditions
* @param float $runtime
* @codeCoverageIgnore
*/
public function recordRuntimeProfilingResult( int $totalFilters, int $totalConditions, float $runtime ) : void {
$keyPrefix = 'abusefilter.runtime-profile.' . $this->localWikiID . '.';

View file

@ -4,6 +4,9 @@ namespace MediaWiki\Extension\AbuseFilter;
use InvalidArgumentException;
/**
* @codeCoverageIgnore
*/
class InvalidImportDataException extends InvalidArgumentException {
/**
* @param string $data That is not valid

View file

@ -19,6 +19,10 @@ use MediaWiki\Extension\AbuseFilter\Parser\ParserFactory;
use MediaWiki\Logger\LoggerFactory;
use MediaWiki\MediaWikiServices;
// This file is actually covered by AbuseFilterServicesTest, but it's not possible to specify a path
// in @covers annotations (https://github.com/sebastianbergmann/phpunit/issues/3794)
// @codeCoverageIgnoreStart
return [
KeywordsManager::SERVICE_NAME => function ( MediaWikiServices $services ): KeywordsManager {
return new KeywordsManager(
@ -125,3 +129,5 @@ return [
);
},
];
// @codeCoverageIgnoreEnd

View file

@ -0,0 +1,33 @@
<?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 ];
}
}
}
}