summaryrefslogtreecommitdiff
path: root/tests/phpunit/includes/LocalisationCacheTest.php
blob: 356db87c6843e352850e49723cf47e0faa77ce07 (plain)
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
<?php

class LocalisationCacheTest extends MediaWikiTestCase {
	public function testPuralRulesFallback() {
		$cache = Language::getLocalisationCache();

		$this->assertEquals(
			$cache->getItem( 'ru', 'pluralRules' ),
			$cache->getItem( 'os', 'pluralRules' ),
			'os plural rules (undefined) fallback to ru (defined)'
		);

		$this->assertEquals(
			$cache->getItem( 'ru', 'compiledPluralRules' ),
			$cache->getItem( 'os', 'compiledPluralRules' ),
			'os compiled plural rules (undefined) fallback to ru (defined)'
		);

		$this->assertNotEquals(
			$cache->getItem( 'ksh', 'pluralRules' ),
			$cache->getItem( 'de', 'pluralRules' ),
			'ksh plural rules (defined) dont fallback to de (defined)'
		);

		$this->assertNotEquals(
			$cache->getItem( 'ksh', 'compiledPluralRules' ),
			$cache->getItem( 'de', 'compiledPluralRules' ),
			'ksh compiled plural rules (defined) dont fallback to de (defined)'
		);
	}
}