Merge "Add data provider to split MediaHandlerTest::testFitBoxWidth"
[lhc/web/wiklou.git] / tests / phpunit / languages / LanguageBe_taraskTest.php
1 <?php
2
3 // @codingStandardsIgnoreStart Ignore Squiz.Classes.ValidClassName.NotCamelCaps
4 class LanguageBe_taraskTest extends LanguageClassesTestCase {
5 // @codingStandardsIgnoreEnd
6 /**
7 * Make sure the language code we are given is indeed
8 * be-tarask. This is to ensure LanguageClassesTestCase
9 * does not give us the wrong language.
10 */
11 public function testBeTaraskTestsUsesBeTaraskCode() {
12 $this->assertEquals( 'be-tarask',
13 $this->getLang()->getCode()
14 );
15 }
16
17 /**
18 * @see bug 23156 & r64981
19 * @covers Language::commafy
20 */
21 public function testSearchRightSingleQuotationMarkAsApostroph() {
22 $this->assertEquals(
23 "'",
24 $this->getLang()->normalizeForSearch( '’' ),
25 'bug 23156: U+2019 conversion to U+0027'
26 );
27 }
28
29 /**
30 * @see bug 23156 & r64981
31 * @covers Language::commafy
32 */
33 public function testCommafy() {
34 $this->assertEquals( '1,234,567', $this->getLang()->commafy( '1234567' ) );
35 $this->assertEquals( '12,345', $this->getLang()->commafy( '12345' ) );
36 }
37
38 /**
39 * @see bug 23156 & r64981
40 * @covers Language::commafy
41 */
42 public function testDoesNotCommafyFourDigitsNumber() {
43 $this->assertEquals( '1234', $this->getLang()->commafy( '1234' ) );
44 }
45
46 /**
47 * @dataProvider providePlural
48 * @covers Language::convertPlural
49 */
50 public function testPlural( $result, $value ) {
51 $forms = array( 'one', 'few', 'many', 'other' );
52 $this->assertEquals( $result, $this->getLang()->convertPlural( $value, $forms ) );
53 }
54
55 /**
56 * @dataProvider providePlural
57 * @covers Language::getPluralRuleType
58 */
59 public function testGetPluralRuleType( $result, $value ) {
60 $this->assertEquals( $result, $this->getLang()->getPluralRuleType( $value ) );
61 }
62
63 public static function providePlural() {
64 return array(
65 array( 'one', 1 ),
66 array( 'many', 11 ),
67 array( 'one', 91 ),
68 array( 'one', 121 ),
69 array( 'few', 2 ),
70 array( 'few', 3 ),
71 array( 'few', 4 ),
72 array( 'few', 334 ),
73 array( 'many', 5 ),
74 array( 'many', 15 ),
75 array( 'many', 120 ),
76 );
77 }
78
79 /**
80 * @dataProvider providePluralTwoForms
81 * @covers Language::convertPlural
82 */
83 public function testPluralTwoForms( $result, $value ) {
84 $forms = array( '1=one', 'other' );
85 $this->assertEquals( $result, $this->getLang()->convertPlural( $value, $forms ) );
86 }
87
88 public static function providePluralTwoForms() {
89 return array(
90 array( 'other', 0 ),
91 array( 'one', 1 ),
92 array( 'other', 11 ),
93 array( 'other', 91 ),
94 array( 'other', 121 ),
95 );
96 }
97 }