wiki.techinc.nl/tests/phpunit/languages/LanguageFallbackStaticMethodsTest.php
Reedy 5f1000f7bd Fix languages/ PSR12.Properties.ConstantVisibility.NotFound
Change-Id: I6f88f2eaf2fc69016b99124eeb9f6e2616c148d2
2020-05-16 21:49:02 +01:00

43 lines
1.1 KiB
PHP

<?php
use MediaWiki\Languages\LanguageFallback;
/**
* @group Language
* @coversDefaultClass Language
*/
class LanguageFallbackStaticMethodsTest extends MediaWikiIntegrationTestCase {
use LanguageFallbackTestTrait {
callMethod as protected traitCallMethod;
}
private function getCallee( array $options = [] ) {
if ( isset( $options['siteLangCode'] ) ) {
$this->setMwGlobals( 'wgLanguageCode', $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';
}
return $this->traitCallMethod( $callee, $method, ...$args );
}
private function getMessagesKey() {
return LanguageFallback::MESSAGES;
}
private function getStrictKey() {
return LanguageFallback::STRICT;
}
}