/** Tests for MediaWiki languages/LanguageSr.php */
class LanguageSrTest extends LanguageClassesTestCase {
-
- ##### TESTS #######################################################
-
- function testEasyConversions( ) {
+ function testEasyConversions() {
$this->assertCyrillic(
'шђчћжШЂЧЋЖ',
'Cyrillic guessing characters'
);
}
- /** @dataProvider providePluralFourForms */
- function testPluralFourForms( $result, $value ) {
+ /** @dataProvider providePlural */
+ function testPlural( $result, $value ) {
$forms = array( 'one', 'few', 'many', 'other' );
$this->assertEquals( $result, $this->getLang()->convertPlural( $value, $forms ) );
}
- function providePluralFourForms() {
+ /** @dataProvider providePlural */
+ function testGetPluralRuleType( $result, $value ) {
+ $this->assertEquals( $result, $this->getLang()->getPluralRuleType( $value ) );
+ }
+
+ public static function providePlural() {
return array (
array( 'one', 1 ),
array( 'many', 11 ),
array( 'many', 120 ),
);
}
+
/** @dataProvider providePluralTwoForms */
function testPluralTwoForms( $result, $value ) {
- $forms = array( 'one', 'several' );
+ $forms = array( '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 ),
);
}
$msg
);
}
+
/**
* Wrapper to verify a text is different once converted to a variant.
* @param $text string Text to convert
$this->assertUnConverted( $text, 'sr-ec', $msg );
$this->assertConverted( $text, 'sr-el', $msg );
}
+
/**
* Verifiy the given Latin text is not converted when using
* using the Latin variant and converted to Cyrillic when using
return $this->getLang()
->mConverter
->convertTo(
- $text, $variant
- );
+ $text, $variant
+ );
}
+
function convertToCyrillic( $text ) {
return $this->convertTo( $text, 'sr-ec' );
}
+
function convertToLatin( $text ) {
return $this->convertTo( $text, 'sr-el' );
}