Debian Codegraph @

tests/phpunit/includes/languages/LanguageMtTest.php

raw symbols SCIP
1 <?php
2 /**
3 * @author Amir E. Aharoni
4 * @copyright Copyright © 2012, Amir E. Aharoni
5 * @file
6 */
7
8 /**
9 * @group Language
10 */
11 class LanguageMtTest extends LanguageClassesTestCase {
12 /**
13 * @dataProvider providePlural
14 * @covers \MediaWiki\Language\Language::convertPlural
15 */
16 public function testPlural( $result, $value ) {
17 $forms = [ 'one', 'few', 'many', 'other' ];
18 $this->assertEquals( $result, $this->getLang()->convertPlural( $value, $forms ) );
19 }
20
21 /**
22 * @dataProvider providePlural
23 * @covers \MediaWiki\Language\Language::getPluralRuleType
24 */
25 public function testGetPluralRuleType( $result, $value ) {
26 $this->assertEquals( $result, $this->getLang()->getPluralRuleType( $value ) );
27 }
28
29 public static function providePlural() {
30 return [
31 [ 'few', 0 ],
32 [ 'one', 1 ],
33 [ 'few', 2 ],
34 [ 'few', 10 ],
35 [ 'many', 11 ],
36 [ 'many', 19 ],
37 [ 'other', 20 ],
38 [ 'other', 99 ],
39 [ 'other', 100 ],
40 [ 'other', 101 ],
41 [ 'few', 102 ],
42 [ 'few', 110 ],
43 [ 'many', 111 ],
44 [ 'many', 119 ],
45 [ 'other', 120 ],
46 [ 'other', 201 ],
47 ];
48 }
49
50 /**
51 * @dataProvider providePluralTwoForms
52 * @covers \MediaWiki\Language\Language::convertPlural
53 */
54 public function testPluralTwoForms( $result, $value ) {
55 $forms = [ 'one', 'other' ];
56 $this->assertEquals( $result, $this->getLang()->convertPlural( $value, $forms ) );
57 }
58
59 public static function providePluralTwoForms() {
60 return [
61 [ 'other', 0 ],
62 [ 'one', 1 ],
63 [ 'other', 2 ],
64 [ 'other', 10 ],
65 [ 'other', 11 ],
66 [ 'other', 19 ],
67 [ 'other', 20 ],
68 [ 'other', 99 ],
69 [ 'other', 100 ],
70 [ 'other', 101 ],
71 [ 'other', 102 ],
72 [ 'other', 110 ],
73 [ 'other', 111 ],
74 [ 'other', 119 ],
75 [ 'other', 120 ],
76 [ 'other', 201 ],
77 ];
78 }
79 }