tests: Widen @covers annotations

> We lose useful coverage and spend valuable time keeping these tags
> accurate through refactors (or worse, forget to do so).
>
> I am not disabling the "only track coverage of specified subject"
> benefits, nor am I claiming coverage in in classes outside the
> subject under test.
>
> Tracking tiny per-method details wastes time in keeping tags
> in sync during refactors, and time to realize (and fix) when people
> inevitably don't keep them in sync, and time lost in finding
> uncovered code to write tests for only to realize it was already
> covered but "not yet claimed".

https://gerrit.wikimedia.org/r/q/owner:Krinkle+is:merged+message:%2522Widen%2522

Change-Id: Iafa241210b81ba1cbfee74e3920fb044c86d09fc
This commit is contained in:
Timo Tijhof 2023-12-14 01:53:19 +00:00
parent 9425bb3248
commit 2ff327df53
5 changed files with 5 additions and 19 deletions

View file

@ -7,7 +7,6 @@ use MediaWiki\ResourceLoader\Context;
/**
* @covers \Cite\ResourceLoader\CiteCSSFileModule
*
* @license GPL-2.0-or-later
*/
class CiteCSSFileModuleTest extends \MediaWikiIntegrationTestCase {

View file

@ -7,7 +7,7 @@ use ParserOptions;
/**
* @group Database
*
* @covers \Cite\ReferenceStack
* @license GPL-2.0-or-later
*/
class CiteDbTest extends \MediaWikiIntegrationTestCase {
@ -15,9 +15,8 @@ class CiteDbTest extends \MediaWikiIntegrationTestCase {
protected $tablesUsed = [ 'page' ];
/**
* Edge case where a parser call within `<ref>` parse clears the original parser state.
* Parser call within `<ref>` parse clears the original parser state.
* @see https://phabricator.wikimedia.org/T240248
* @covers \Cite\ReferenceStack::pushRef
*/
public function testReferenceStackError() {
$this->insertPage( 'Cite-tracking-category-cite-error', '{{PAGENAME}}', NS_MEDIAWIKI );

View file

@ -7,15 +7,11 @@ use Cite\Hooks\CiteHooks;
use MediaWiki\User\Options\StaticUserOptionsLookup;
/**
* @coversDefaultClass \Cite\Hooks\CiteHooks
*
* @covers \Cite\Hooks\CiteHooks
* @license GPL-2.0-or-later
*/
class CiteHooksTest extends \MediaWikiIntegrationTestCase {
/**
* @covers ::onResourceLoaderGetConfigVars
*/
public function testOnResourceLoaderGetConfigVars() {
$vars = [];
@ -28,9 +24,6 @@ class CiteHooksTest extends \MediaWikiIntegrationTestCase {
$this->assertArrayHasKey( 'wgCiteResponsiveReferences', $vars );
}
/**
* @covers ::onAPIQuerySiteInfoGeneralInfo
*/
public function testOnAPIQuerySiteInfoGeneralInfo() {
$api = $this->createMock( ApiQuerySiteinfo::class );
$api->expects( $this->once() )

View file

@ -12,8 +12,7 @@ use ParserOptions;
use Wikimedia\TestingAccessWrapper;
/**
* @coversDefaultClass \Cite\Cite
*
* @covers \Cite\Cite
* @license GPL-2.0-or-later
*/
class CiteIntegrationTest extends \MediaWikiIntegrationTestCase {
@ -24,7 +23,6 @@ class CiteIntegrationTest extends \MediaWikiIntegrationTestCase {
}
/**
* @covers ::checkRefsNoReferences
* @dataProvider provideCheckRefsNoReferences
*/
public function testCheckRefsNoReferences(

View file

@ -6,13 +6,10 @@ use Cite\ReferenceMessageLocalizer;
use LanguageQqx;
/**
* @coversDefaultClass \Cite\ReferenceMessageLocalizer
* @covers \Cite\ReferenceMessageLocalizer
*/
class ReferenceMessageLocalizerTest extends \MediaWikiIntegrationTestCase {
/**
* @covers ::msg
*/
public function testMsg() {
$localizer = new ReferenceMessageLocalizer( new LanguageQqx() );
$this->assertSame(