wiki.techinc.nl/tests/phpunit/includes/language/LanguageFallbackIntegrationTest.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

31 lines
838 B
PHP

<?php
use MediaWiki\Languages\LanguageFallback;
use MediaWiki\MainConfigNames;
/**
* @group Language
* @covers \MediaWiki\Languages\LanguageFallback
*/
class LanguageFallbackIntegrationTest extends MediaWikiIntegrationTestCase {
use LanguageFallbackTestTrait;
private function getCallee( array $options = [] ) {
if ( isset( $options['siteLangCode'] ) ) {
$this->overrideConfigValue( MainConfigNames::LanguageCode, $options['siteLangCode'] );
}
if ( isset( $options['fallbackMap'] ) ) {
$this->setService( 'LocalisationCache', $this->getMockLocalisationCache(
1, $options['fallbackMap'] ) );
}
return $this->getServiceContainer()->getLanguageFallback();
}
private function getMessagesKey() {
return LanguageFallback::MESSAGES;
}
private function getStrictKey() {
return LanguageFallback::STRICT;
}
}