blob: 39d0d5977317f8daf5da493c0602c809d69ec939 (
plain) (
blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
|
<?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;
}
}
|