wiki.techinc.nl/tests/phpunit/includes/language/LanguageFallbackStaticMethodsTest.php
Umherirrender 9bcd6f7f80 tests: Move all language converter tests into /includes/
Move tests from /languages/ to /includes/language/ similiar to the
classes in f5644ba
Clean up suite config too not longer run that folder as test,
remove from coverage, there no php files to cover

Remove converter tests from Language*Test files,
all identical to the *ConverterTest cases (or remove the whole file)

Change-Id: I098ba241bd61d8ed2ee9b65393416077e3544e79
2023-02-01 20:10:56 +01:00

45 lines
1.2 KiB
PHP

<?php
use MediaWiki\Languages\LanguageFallback;
use MediaWiki\MainConfigNames;
/**
* @group Language
* @coversDefaultClass Language
*/
class LanguageFallbackStaticMethodsTest extends MediaWikiIntegrationTestCase {
use LanguageFallbackTestTrait {
callMethod as protected traitCallMethod;
}
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 Language::class;
}
private function callMethod( $callee, $method, ...$args ) {
if ( $method === 'getFirst' ) {
$method = 'getFallbackFor';
} elseif ( $method === 'getAll' ) {
$method = 'getFallbacksFor';
} elseif ( $method === 'getAllIncludingSiteLanguage' ) {
$method = 'getFallbacksIncludingSiteLanguage';
}
$this->hideDeprecated( 'Language::' . $method );
return $this->traitCallMethod( $callee, $method, ...$args );
}
private function getMessagesKey() {
return LanguageFallback::MESSAGES;
}
private function getStrictKey() {
return LanguageFallback::STRICT;
}
}