wiki.techinc.nl/tests/phpunit/includes/language/LanguageConverterIntegrationTest.php
Timo Tijhof 4160c223f2 language: Widen @covers tags in phpunit tests
Add a few missing `@group Language` tags as well.
Remove stray `@group Cache` from two classes since "Cache" is not a
MediaWiki core component (per T248519 and related tasks, we did long
ago in Bugzilla have a "MediaWiki-Cache" category, but that's since
been re-orged into BagOStuff, HTTP-Cache, and Parser/ParserCache,
and Internationalization/LocalisationCache, per the description at
<https://phabricator.wikimedia.org/project/profile/1329/>.)

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

> Given all called methods are de-facto and liberally claimed, and
> that we keep the coverage limited to the subject class, it maintains
> the spirit and intent by listing the class explicitly instead.
>
> PHPUnit offers a more precise tool when you need it (i.e. when testing
> legacy monster/god classes), but for well-written code, the
> class-wide tag is exactly what you want.
>
> We lose useful coverage and waste valuable time on keeping tags
> accurate through refactors (or worse, forget to do so).
> Tracking tiny per-method details wastes time in realizing (and
> fixing) when people inevitably don't keep them in sync, and time
> lost in finding uncovered code to write tests to realize it was
> already covered but "not yet claimed".

Bug: T364652
Change-Id: I9cfc4c210b90bfed6fd988a2525f80f5f5ee4870
2024-06-25 18:51:54 +00:00

20 lines
656 B
PHP

<?php
/**
* @group Language
* @covers \LanguageConverter
*/
class LanguageConverterIntegrationTest extends MediaWikiIntegrationTestCase {
use LanguageConverterTestTrait;
public function testHasVariant() {
// See LanguageSrTest::testHasVariant() for additional tests
$converterEn = $this->getLanguageConverter( 'en' );
$this->assertTrue( $converterEn->hasVariant( 'en' ), 'base is always a variant' );
$this->assertFalse( $converterEn->hasVariant( 'en-bogus' ), 'bogus en variant' );
$converterBogus = $this->getLanguageConverter( 'bogus' );
$this->assertTrue( $converterBogus->hasVariant( 'bogus' ), 'base is always a variant' );
}
}