summaryrefslogtreecommitdiff
path: root/tests/phpunit/languages/LanguageUkTest.php
diff options
context:
space:
mode:
Diffstat (limited to 'tests/phpunit/languages/LanguageUkTest.php')
-rw-r--r--tests/phpunit/languages/LanguageUkTest.php64
1 files changed, 41 insertions, 23 deletions
diff --git a/tests/phpunit/languages/LanguageUkTest.php b/tests/phpunit/languages/LanguageUkTest.php
index 60fafb0d..9051bcff 100644
--- a/tests/phpunit/languages/LanguageUkTest.php
+++ b/tests/phpunit/languages/LanguageUkTest.php
@@ -6,25 +6,38 @@
* @file
*/
-/** Tests for MediaWiki languages/classes/LanguageUk.php */
-class LanguageUkTest extends MediaWikiTestCase {
- private $lang;
-
- function setUp() {
- $this->lang = Language::factory( 'Uk' );
+/** Tests for Ukrainian */
+class LanguageUkTest extends LanguageClassesTestCase {
+ /**
+ * @dataProvider providePlural
+ * @covers Language::convertPlural
+ */
+ public function testPlural( $result, $value ) {
+ $forms = array( 'one', 'few', 'many', 'other' );
+ $this->assertEquals( $result, $this->getLang()->convertPlural( $value, $forms ) );
}
- function tearDown() {
- unset( $this->lang );
+
+ /**
+ * Test explicit plural forms - n=FormN forms
+ * @covers Language::convertPlural
+ */
+ public function testExplicitPlural() {
+ $forms = array( 'one', 'few', 'many', 'other', '12=dozen' );
+ $this->assertEquals( 'dozen', $this->getLang()->convertPlural( 12, $forms ) );
+ $forms = array( 'one', 'few', 'many', '100=hundred', 'other', '12=dozen' );
+ $this->assertEquals( 'hundred', $this->getLang()->convertPlural( 100, $forms ) );
}
- /** @dataProvider providePluralFourForms */
- function testPluralFourForms( $result, $value ) {
- $forms = array( 'one', 'few', 'many', 'other' );
- $this->assertEquals( $result, $this->lang->convertPlural( $value, $forms ) );
+ /**
+ * @dataProvider providePlural
+ * @covers Language::getPluralRuleType
+ */
+ public function testGetPluralRuleType( $result, $value ) {
+ $this->assertEquals( $result, $this->getLang()->getPluralRuleType( $value ) );
}
- function providePluralFourForms() {
- return array (
+ public static function providePlural() {
+ return array(
array( 'one', 1 ),
array( 'many', 11 ),
array( 'one', 91 ),
@@ -38,17 +51,22 @@ class LanguageUkTest extends MediaWikiTestCase {
array( 'many', 120 ),
);
}
- /** @dataProvider providePluralTwoForms */
- function testPluralTwoForms( $result, $value ) {
- $forms = array( 'one', 'several' );
- $this->assertEquals( $result, $this->lang->convertPlural( $value, $forms ) );
+
+ /**
+ * @dataProvider providePluralTwoForms
+ * @covers Language::convertPlural
+ */
+ public function testPluralTwoForms( $result, $value ) {
+ $forms = array( '1=one', 'other' );
+ $this->assertEquals( $result, $this->getLang()->convertPlural( $value, $forms ) );
}
- function providePluralTwoForms() {
- return array (
+
+ public static function providePluralTwoForms() {
+ return array(
array( 'one', 1 ),
- array( 'several', 11 ),
- array( 'several', 91 ),
- array( 'several', 121 ),
+ array( 'other', 11 ),
+ array( 'other', 91 ),
+ array( 'other', 121 ),
);
}
}