2011-11-16 15:12:00 +00:00
|
|
|
<?php
|
|
|
|
|
/**
|
|
|
|
|
* @author Antoine Musso <hashar at free dot fr>
|
|
|
|
|
* @copyright Copyright © 2011, Antoine Musso <hashar at free dot fr>
|
|
|
|
|
* @file
|
|
|
|
|
*/
|
|
|
|
|
|
2017-12-28 08:24:40 +00:00
|
|
|
/**
|
2021-07-31 21:23:21 +00:00
|
|
|
* 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
|
2017-12-28 08:24:40 +00:00
|
|
|
*/
|
2012-10-23 20:53:17 +00:00
|
|
|
class LanguageSrTest extends LanguageClassesTestCase {
|
2013-10-22 10:32:29 +00:00
|
|
|
/**
|
|
|
|
|
* @dataProvider providePlural
|
|
|
|
|
* @covers Language::convertPlural
|
|
|
|
|
*/
|
|
|
|
|
public function testPlural( $result, $value ) {
|
2016-02-17 09:09:32 +00:00
|
|
|
$forms = [ 'one', 'few', 'other' ];
|
2012-10-23 20:53:17 +00:00
|
|
|
$this->assertEquals( $result, $this->getLang()->convertPlural( $value, $forms ) );
|
2012-02-01 15:59:26 +00:00
|
|
|
}
|
2011-11-16 15:12:00 +00:00
|
|
|
|
2013-10-22 10:32:29 +00:00
|
|
|
/**
|
|
|
|
|
* @dataProvider providePlural
|
|
|
|
|
* @covers Language::getPluralRuleType
|
|
|
|
|
*/
|
|
|
|
|
public function testGetPluralRuleType( $result, $value ) {
|
2013-01-25 01:10:37 +00:00
|
|
|
$this->assertEquals( $result, $this->getLang()->getPluralRuleType( $value ) );
|
|
|
|
|
}
|
|
|
|
|
|
2013-03-22 02:12:37 +00:00
|
|
|
public static function providePlural() {
|
2016-02-17 09:09:32 +00:00
|
|
|
return [
|
|
|
|
|
[ 'one', 1 ],
|
|
|
|
|
[ 'other', 11 ],
|
|
|
|
|
[ 'one', 91 ],
|
|
|
|
|
[ 'one', 121 ],
|
|
|
|
|
[ 'few', 2 ],
|
|
|
|
|
[ 'few', 3 ],
|
|
|
|
|
[ 'few', 4 ],
|
|
|
|
|
[ 'few', 334 ],
|
|
|
|
|
[ 'other', 5 ],
|
|
|
|
|
[ 'other', 15 ],
|
|
|
|
|
[ 'other', 120 ],
|
|
|
|
|
];
|
2012-02-01 15:59:26 +00:00
|
|
|
}
|
2013-02-15 10:27:48 +00:00
|
|
|
|
2013-10-22 10:32:29 +00:00
|
|
|
/**
|
|
|
|
|
* @dataProvider providePluralTwoForms
|
|
|
|
|
* @covers Language::convertPlural
|
|
|
|
|
*/
|
|
|
|
|
public function testPluralTwoForms( $result, $value ) {
|
2016-02-17 09:09:32 +00:00
|
|
|
$forms = [ 'one', 'other' ];
|
2012-10-23 20:53:17 +00:00
|
|
|
$this->assertEquals( $result, $this->getLang()->convertPlural( $value, $forms ) );
|
2012-02-01 15:59:26 +00:00
|
|
|
}
|
2013-02-15 10:27:48 +00:00
|
|
|
|
2013-03-22 02:12:37 +00:00
|
|
|
public static function providePluralTwoForms() {
|
2016-02-17 09:09:32 +00:00
|
|
|
return [
|
|
|
|
|
[ 'one', 1 ],
|
|
|
|
|
[ 'other', 11 ],
|
|
|
|
|
[ 'other', 4 ],
|
|
|
|
|
[ 'one', 91 ],
|
|
|
|
|
[ 'one', 121 ],
|
|
|
|
|
];
|
2011-11-16 15:12:00 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
|
|
}
|