| 1 |
<?php |
| 2 |
|
| 3 |
|
| 4 |
i |
| 5 |
|
| 6 |
|
| 7 |
|
| 8 |
|
| 9 |
|
| 10 |
|
| 11 |
class LanguagePlTest extends LanguageClassesTestCase { |
| 12 |
|
| 13 |
|
| 14 |
|
| 15 |
|
| 16 |
public function testPlural( $result, $value ) { |
| 17 |
$forms = [ 'one', 'few', 'many' ]; |
| 18 |
$this->assertEquals( $result, $this->getLang()->convertPlural( $value, $forms ) ); |
| 19 |
} |
| 20 |
|
| 21 |
|
| 22 |
|
| 23 |
|
| 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 |
[ 'many', 0 ], |
| 32 |
[ 'one', 1 ], |
| 33 |
[ 'few', 2 ], |
| 34 |
[ 'few', 3 ], |
| 35 |
[ 'few', 4 ], |
| 36 |
[ 'many', 5 ], |
| 37 |
[ 'many', 9 ], |
| 38 |
[ 'many', 10 ], |
| 39 |
[ 'many', 11 ], |
| 40 |
[ 'many', 21 ], |
| 41 |
[ 'few', 22 ], |
| 42 |
[ 'few', 23 ], |
| 43 |
[ 'few', 24 ], |
| 44 |
[ 'many', 25 ], |
| 45 |
[ 'many', 200 ], |
| 46 |
[ 'many', 201 ], |
| 47 |
]; |
| 48 |
} |
| 49 |
|
| 50 |
|
| 51 |
|
| 52 |
|
| 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', 3 ], |
| 65 |
[ 'other', 4 ], |
| 66 |
[ 'other', 5 ], |
| 67 |
[ 'other', 9 ], |
| 68 |
[ 'other', 10 ], |
| 69 |
[ 'other', 11 ], |
| 70 |
[ 'other', 21 ], |
| 71 |
[ 'other', 22 ], |
| 72 |
[ 'other', 23 ], |
| 73 |
[ 'other', 24 ], |
| 74 |
[ 'other', 25 ], |
| 75 |
[ 'other', 200 ], |
| 76 |
[ 'other', 201 ], |
| 77 |
]; |
| 78 |
} |
| 79 |
|
| 80 |
|
| 81 |
|
| 82 |
|
| 83 |
|
| 84 |
public function testFormatNum( $number, $formattedNum, $desc ) { |
| 85 |
$this->assertEquals( |
| 86 |
$formattedNum, |
| 87 |
$this->getLang()->formatNum( $number ), |
| 88 |
$desc |
| 89 |
); |
| 90 |
} |
| 91 |
|
| 92 |
public static function provideFormatNum() { |
| 93 |
return [ |
| 94 |
[ 1000, '1000', 'No change' ], |
| 95 |
[ 10000, '10 000', 'Only separator transform. Separator is NO-BREAK Space, not Space' ], |
| 96 |
[ 1000.0001, '1000,0001', |
| 97 |
'No change since this is below minimumGroupingDigits, just separator transform' ], |
| 98 |
[ 10000.123456, '10 000,123456', 'separator transform' ], |
| 99 |
[ -1000, '−1000', 'No change, other than minus replacement' ], |
| 100 |
[ -10000, '−10 000', 'Only separator transform' ], |
| 101 |
[ -1000.0001, '−1000,0001', |
| 102 |
'No change since this is below minimumGroupingDigits, just separator transform' ], |
| 103 |
[ -10000.789, '−10 000,789', '' ], |
| 104 |
]; |
| 105 |
} |
| 106 |
} |