Added release notes for 'ContentHandler::runLegacyHooks' removal
[mediawiki.git] / tests / phpunit / languages / classes / LanguageUkTest.php
blob6b259823bebee7646e6b2f20646ac7dc34dd4414
1 <?php
2 /**
3 * @author Amir E. Aharoni
4 * based on LanguageBe_tarask.php
5 * @copyright Copyright © 2012, Amir E. Aharoni
6 * @file
7 */
9 /** Tests for Ukrainian */
10 class LanguageUkTest extends LanguageClassesTestCase {
11 /**
12 * @dataProvider providePlural
13 * @covers Language::convertPlural
15 public function testPlural( $result, $value ) {
16 $forms = [ 'one', 'few', 'many', 'other' ];
17 $this->assertEquals( $result, $this->getLang()->convertPlural( $value, $forms ) );
20 /**
21 * Test explicit plural forms - n=FormN forms
22 * @covers Language::convertPlural
24 public function testExplicitPlural() {
25 $forms = [ 'one', 'few', 'many', 'other', '12=dozen' ];
26 $this->assertEquals( 'dozen', $this->getLang()->convertPlural( 12, $forms ) );
27 $forms = [ 'one', 'few', 'many', '100=hundred', 'other', '12=dozen' ];
28 $this->assertEquals( 'hundred', $this->getLang()->convertPlural( 100, $forms ) );
31 /**
32 * @dataProvider providePlural
33 * @covers Language::getPluralRuleType
35 public function testGetPluralRuleType( $result, $value ) {
36 $this->assertEquals( $result, $this->getLang()->getPluralRuleType( $value ) );
39 public static function providePlural() {
40 return [
41 [ 'one', 1 ],
42 [ 'many', 11 ],
43 [ 'one', 91 ],
44 [ 'one', 121 ],
45 [ 'few', 2 ],
46 [ 'few', 3 ],
47 [ 'few', 4 ],
48 [ 'few', 334 ],
49 [ 'many', 5 ],
50 [ 'many', 15 ],
51 [ 'many', 120 ],
55 /**
56 * @dataProvider providePluralTwoForms
57 * @covers Language::convertPlural
59 public function testPluralTwoForms( $result, $value ) {
60 $forms = [ '1=one', 'other' ];
61 $this->assertEquals( $result, $this->getLang()->convertPlural( $value, $forms ) );
64 public static function providePluralTwoForms() {
65 return [
66 [ 'one', 1 ],
67 [ 'other', 11 ],
68 [ 'other', 91 ],
69 [ 'other', 121 ],
73 /**
74 * @dataProvider providerGrammar
75 * @covers Language::convertGrammar
77 public function testGrammar( $result, $word, $case ) {
78 $this->assertEquals( $result, $this->getLang()->convertGrammar( $word, $case ) );
81 public static function providerGrammar() {
82 return [
84 'Вікіпедії',
85 'Вікіпедія',
86 'genitive',
89 'Віківидів',
90 'Віківиди',
91 'genitive',
94 'Вікіцитат',
95 'Вікіцитати',
96 'genitive',
99 'Вікіпідручника',
100 'Вікіпідручник',
101 'genitive',
104 'Вікіпедію',
105 'Вікіпедія',
106 'accusative',