Merge "Update docs/hooks.txt for ShowSearchHitTitle"
[mediawiki.git] / tests / phpunit / languages / classes / LanguageMtTest.php
blobd8a0d7a1dd0c3e700b247ab5f3049bc543f6705f
1 <?php
2 /**
3 * @author Amir E. Aharoni
4 * @copyright Copyright © 2012, Amir E. Aharoni
5 * @file
6 */
8 /** Tests for MediaWiki languages/classes/LanguageMt.php */
9 class LanguageMtTest extends LanguageClassesTestCase {
10 /**
11 * @dataProvider providePlural
12 * @covers Language::convertPlural
14 public function testPlural( $result, $value ) {
15 $forms = [ 'one', 'few', 'many', 'other' ];
16 $this->assertEquals( $result, $this->getLang()->convertPlural( $value, $forms ) );
19 /**
20 * @dataProvider providePlural
21 * @covers Language::getPluralRuleType
23 public function testGetPluralRuleType( $result, $value ) {
24 $this->assertEquals( $result, $this->getLang()->getPluralRuleType( $value ) );
27 public static function providePlural() {
28 return [
29 [ 'few', 0 ],
30 [ 'one', 1 ],
31 [ 'few', 2 ],
32 [ 'few', 10 ],
33 [ 'many', 11 ],
34 [ 'many', 19 ],
35 [ 'other', 20 ],
36 [ 'other', 99 ],
37 [ 'other', 100 ],
38 [ 'other', 101 ],
39 [ 'few', 102 ],
40 [ 'few', 110 ],
41 [ 'many', 111 ],
42 [ 'many', 119 ],
43 [ 'other', 120 ],
44 [ 'other', 201 ],
48 /**
49 * @dataProvider providePluralTwoForms
50 * @covers Language::convertPlural
52 public function testPluralTwoForms( $result, $value ) {
53 $forms = [ 'one', 'other' ];
54 $this->assertEquals( $result, $this->getLang()->convertPlural( $value, $forms ) );
57 public static function providePluralTwoForms() {
58 return [
59 [ 'other', 0 ],
60 [ 'one', 1 ],
61 [ 'other', 2 ],
62 [ 'other', 10 ],
63 [ 'other', 11 ],
64 [ 'other', 19 ],
65 [ 'other', 20 ],
66 [ 'other', 99 ],
67 [ 'other', 100 ],
68 [ 'other', 101 ],
69 [ 'other', 102 ],
70 [ 'other', 110 ],
71 [ 'other', 111 ],
72 [ 'other', 119 ],
73 [ 'other', 120 ],
74 [ 'other', 201 ],