wiki.techinc.nl/tests/phpunit/includes/languages/LanguageSrTest.php
Umherirrender 9bcd6f7f80 tests: Move all language converter tests into /includes/
Move tests from /languages/ to /includes/language/ similiar to the
classes in f5644ba
Clean up suite config too not longer run that folder as test,
remove from coverage, there no php files to cover

Remove converter tests from Language*Test files,
all identical to the *ConverterTest cases (or remove the whole file)

Change-Id: I098ba241bd61d8ed2ee9b65393416077e3544e79
2023-02-01 20:10:56 +01:00

74 lines
1.6 KiB
PHP

<?php
/**
* @author Antoine Musso <hashar at free dot fr>
* @copyright Copyright © 2011, Antoine Musso <hashar at free dot fr>
* @file
*/
/**
* Tests for Serbian
*
* The language can be represented using two scripts:
*
* - Latin (SR_el)
* - Cyrillic (SR_ec)
*
* Both representations seems to be bijective, hence MediaWiki can convert
* from one script to the other.
*
* @group Language
*/
class LanguageSrTest extends LanguageClassesTestCase {
/**
* @dataProvider providePlural
* @covers Language::convertPlural
*/
public function testPlural( $result, $value ) {
$forms = [ 'one', 'few', 'other' ];
$this->assertEquals( $result, $this->getLang()->convertPlural( $value, $forms ) );
}
/**
* @dataProvider providePlural
* @covers Language::getPluralRuleType
*/
public function testGetPluralRuleType( $result, $value ) {
$this->assertEquals( $result, $this->getLang()->getPluralRuleType( $value ) );
}
public static function providePlural() {
return [
[ 'one', 1 ],
[ 'other', 11 ],
[ 'one', 91 ],
[ 'one', 121 ],
[ 'few', 2 ],
[ 'few', 3 ],
[ 'few', 4 ],
[ 'few', 334 ],
[ 'other', 5 ],
[ 'other', 15 ],
[ 'other', 120 ],
];
}
/**
* @dataProvider providePluralTwoForms
* @covers Language::convertPlural
*/
public function testPluralTwoForms( $result, $value ) {
$forms = [ 'one', 'other' ];
$this->assertEquals( $result, $this->getLang()->convertPlural( $value, $forms ) );
}
public static function providePluralTwoForms() {
return [
[ 'one', 1 ],
[ 'other', 11 ],
[ 'other', 4 ],
[ 'one', 91 ],
[ 'one', 121 ],
];
}
}