2020-01-23 18:39:23 +00:00
|
|
|
<?php
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
|
* @group Language
|
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-14 19:51:04 +00:00
|
|
|
* @covers \LanguageConverter
|
2020-01-23 18:39:23 +00:00
|
|
|
*/
|
2020-06-30 15:09:24 +00:00
|
|
|
class LanguageConverterIntegrationTest extends MediaWikiIntegrationTestCase {
|
2020-01-23 18:39:23 +00:00
|
|
|
|
2023-02-13 07:02:16 +00:00
|
|
|
use LanguageConverterTestTrait;
|
2020-01-23 18:39:23 +00:00
|
|
|
|
|
|
|
|
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' );
|
|
|
|
|
}
|
|
|
|
|
}
|