| 1 |
<?php |
| 2 |
|
| 3 |
|
| 4 |
i |
| 5 |
|
| 6 |
|
| 7 |
|
| 8 |
|
| 9 |
|
| 10 |
|
| 11 |
class LanguageUkTest extends LanguageClassesTestCase { |
| 12 |
|
| 13 |
|
| 14 |
|
| 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 |
|
| 23 |
|
| 24 |
|
| 25 |
public function testExplicitPlural() { |
| 26 |
$forms = [ 'one', 'few', 'many', 'other', '12=dozen' ]; |
| 27 |
$this->assertEquals( 'dozen', $this->getLang()->convertPlural( 12, $forms ) ); |
| 28 |
$forms = [ 'one', 'few', 'many', '100=hundred', 'other', '12=dozen' ]; |
| 29 |
$this->assertEquals( 'hundred', $this->getLang()->convertPlural( 100, $forms ) ); |
| 30 |
} |
| 31 |
|
| 32 |
|
| 33 |
|
| 34 |
|
| 35 |
|
| 36 |
public function testGetPluralRuleType( $result, $value ) { |
| 37 |
$this->assertEquals( $result, $this->getLang()->getPluralRuleType( $value ) ); |
| 38 |
} |
| 39 |
|
| 40 |
public static function providePlural() { |
| 41 |
return [ |
| 42 |
[ 'one', 1 ], |
| 43 |
[ 'many', 11 ], |
| 44 |
[ 'one', 91 ], |
| 45 |
[ 'one', 121 ], |
| 46 |
[ 'few', 2 ], |
| 47 |
[ 'few', 3 ], |
| 48 |
[ 'few', 4 ], |
| 49 |
[ 'few', 334 ], |
| 50 |
[ 'many', 5 ], |
| 51 |
[ 'many', 15 ], |
| 52 |
[ 'many', 120 ], |
| 53 |
]; |
| 54 |
} |
| 55 |
|
| 56 |
|
| 57 |
|
| 58 |
|
| 59 |
|
| 60 |
public function testPluralTwoForms( $result, $value ) { |
| 61 |
$forms = [ '1=one', 'other' ]; |
| 62 |
$this->assertEquals( $result, $this->getLang()->convertPlural( $value, $forms ) ); |
| 63 |
} |
| 64 |
|
| 65 |
public static function providePluralTwoForms() { |
| 66 |
return [ |
| 67 |
[ 'one', 1 ], |
| 68 |
[ 'other', 11 ], |
| 69 |
[ 'other', 91 ], |
| 70 |
[ 'other', 121 ], |
| 71 |
]; |
| 72 |
} |
| 73 |
|
| 74 |
|
| 75 |
|
| 76 |
|
| 77 |
|
| 78 |
public function testGrammar( $result, $word, $case ) { |
| 79 |
$this->assertEquals( $result, $this->getLang()->convertGrammar( $word, $case ) ); |
| 80 |
} |
| 81 |
|
| 82 |
public static function providerGrammar() { |
| 83 |
yield 'Wikipedia genitive' => [ |
| 84 |
'Вікіпедії', |
| 85 |
'Вікіпедія', |
| 86 |
'genitive', |
| 87 |
]; |
| 88 |
yield 'Wikispecies genitive' => [ |
| 89 |
'Віківидів', |
| 90 |
'Віківиди', |
| 91 |
'genitive', |
| 92 |
]; |
| 93 |
yield 'Wikiquote genitive' => [ |
| 94 |
'Вікіцитат', |
| 95 |
'Вікіцитати', |
| 96 |
'genitive', |
| 97 |
]; |
| 98 |
yield 'Wikibooks genitive' => [ |
| 99 |
'Вікіпідручника', |
| 100 |
'Вікіпідручник', |
| 101 |
'genitive', |
| 102 |
]; |
| 103 |
yield 'Wikipedia accusative' => [ |
| 104 |
'Вікіпедію', |
| 105 |
'Вікіпедія', |
| 106 |
'accusative', |
| 107 |
]; |
| 108 |
yield 'MediaWiki locative' => [ |
| 109 |
'у MediaWiki', |
| 110 |
'MediaWiki', |
| 111 |
'locative', |
| 112 |
]; |
| 113 |
} |
| 114 |
} |