This replaces the static Language methods getFallbackFor(), getFallbacksFor(), and getFallbacksIncludingSiteLanguage(). There is 100% unit and integration test coverage for the new class. One deliberate functional change: I changed one place where we threw MWException to InvalidArgumentException. Bug: T201405 Depends-On: Ie7a89f6ed7d52a0bc01672019ff92e7ee105a1f3 Change-Id: I49222eb55f1feec5b1dcd40f364cffe0c8801855
31 lines
841 B
PHP
31 lines
841 B
PHP
<?php
|
|
|
|
use MediaWiki\Languages\LanguageFallback;
|
|
use MediaWiki\MediaWikiServices;
|
|
|
|
/**
|
|
* @coversDefaultClass MediaWiki\Languages\LanguageFallback
|
|
* @covers ::__construct
|
|
*/
|
|
class LanguageFallbackIntegrationTest extends MediaWikiIntegrationTestCase {
|
|
use LanguageFallbackTestTrait;
|
|
|
|
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 MediaWikiServices::getInstance()->getLanguageFallback();
|
|
}
|
|
|
|
private function getMessagesKey() {
|
|
return LanguageFallback::MESSAGES;
|
|
}
|
|
|
|
private function getStrictKey() {
|
|
return LanguageFallback::STRICT;
|
|
}
|
|
}
|