wiki.techinc.nl/tests/phpunit/includes/language/LanguageFallbackIntegrationTest.php
Aryeh Gregor 8c4f59db64 New LanguageFallback service
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
2019-10-08 15:11:39 -07:00

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;
}
}