Debian Codegraph @

tests/phpunit/includes/languages/LanguageSgsTest.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 * Tests for Samogitian
10 *
11 * @group Language
12 */
13 class LanguageSgsTest extends LanguageClassesTestCase {
14 /**
15 * @dataProvider providePluralAllForms
16 * @covers \MediaWiki\Language\Language::convertPlural
17 */
18 public function testPluralAllForms( $result, $value ) {
19 $forms = [ 'one', 'two', 'few', 'other' ];
20 $this->assertEquals( $result, $this->getLang()->convertPlural( $value, $forms ) );
21 }
22
23 /**
24 * @dataProvider providePluralAllForms
25 * @covers \MediaWiki\Language\Language::getPluralRuleType
26 */
27 public function testGetPluralRuleType( $result, $value ) {
28 $this->assertEquals( $result, $this->getLang()->getPluralRuleType( $value ) );
29 }
30
31 public static function providePluralAllForms() {
32 return [
33 [ 'few', 0 ],
34 [ 'one', 1 ],
35 [ 'two', 2 ],
36 [ 'other', 3 ],
37 [ 'few', 10 ],
38 [ 'few', 11 ],
39 [ 'few', 12 ],
40 [ 'few', 19 ],
41 [ 'other', 20 ],
42 [ 'few', 100 ],
43 [ 'one', 101 ],
44 [ 'few', 111 ],
45 [ 'few', 112 ],
46 ];
47 }
48
49 /**
50 * @dataProvider providePluralTwoForms
51 * @covers \MediaWiki\Language\Language::convertPlural
52 */
53 public function testPluralTwoForms( $result, $value ) {
54 $forms = [ 'one', 'other' ];
55 $this->assertEquals( $result, $this->getLang()->convertPlural( $value, $forms ) );
56 }
57
58 public static function providePluralTwoForms() {
59 return [
60 [ 'other', 0 ],
61 [ 'one', 1 ],
62 [ 'other', 2 ],
63 [ 'other', 3 ],
64 [ 'other', 10 ],
65 [ 'other', 11 ],
66 [ 'other', 12 ],
67 [ 'other', 19 ],
68 [ 'other', 20 ],
69 [ 'other', 100 ],
70 [ 'one', 101 ],
71 [ 'other', 111 ],
72 [ 'other', 112 ],
73 ];
74 }
75 }