2010-12-14 16:26:35 +00:00
|
|
|
|
<?php
|
|
|
|
|
|
|
2018-01-01 13:10:16 +00:00
|
|
|
|
// phpcs:disable Squiz.Classes.ValidClassName.NotCamelCaps
|
2021-07-31 21:23:21 +00:00
|
|
|
|
|
2017-12-28 08:24:40 +00:00
|
|
|
|
/**
|
2021-07-31 21:23:21 +00:00
|
|
|
|
* @group Language
|
2017-12-28 08:24:40 +00:00
|
|
|
|
* @covers LanguageBe_tarask
|
|
|
|
|
|
*/
|
2012-10-23 20:53:17 +00:00
|
|
|
|
class LanguageBe_taraskTest extends LanguageClassesTestCase {
|
2018-01-01 13:10:16 +00:00
|
|
|
|
// phpcs:enable
|
2020-05-30 10:36:42 +00:00
|
|
|
|
|
2012-10-23 20:53:17 +00:00
|
|
|
|
/**
|
|
|
|
|
|
* Make sure the language code we are given is indeed
|
|
|
|
|
|
* be-tarask. This is to ensure LanguageClassesTestCase
|
|
|
|
|
|
* does not give us the wrong language.
|
|
|
|
|
|
*/
|
2013-10-22 10:32:29 +00:00
|
|
|
|
public function testBeTaraskTestsUsesBeTaraskCode() {
|
2012-10-23 20:53:17 +00:00
|
|
|
|
$this->assertEquals( 'be-tarask',
|
|
|
|
|
|
$this->getLang()->getCode()
|
|
|
|
|
|
);
|
2010-12-14 16:26:35 +00:00
|
|
|
|
}
|
|
|
|
|
|
|
2013-10-22 10:32:29 +00:00
|
|
|
|
/**
|
2017-02-20 23:45:58 +00:00
|
|
|
|
* @see T25156 & r64981
|
2017-06-02 08:42:28 +00:00
|
|
|
|
* @covers Language::normalizeForSearch
|
2013-10-22 10:32:29 +00:00
|
|
|
|
*/
|
|
|
|
|
|
public function testSearchRightSingleQuotationMarkAsApostroph() {
|
2010-12-14 16:26:35 +00:00
|
|
|
|
$this->assertEquals(
|
|
|
|
|
|
"'",
|
2012-10-23 20:53:17 +00:00
|
|
|
|
$this->getLang()->normalizeForSearch( '’' ),
|
2017-02-20 23:45:58 +00:00
|
|
|
|
'T25156: U+2019 conversion to U+0027'
|
2010-12-14 16:26:35 +00:00
|
|
|
|
);
|
|
|
|
|
|
}
|
2013-02-15 10:27:48 +00:00
|
|
|
|
|
2013-10-22 10:32:29 +00:00
|
|
|
|
/**
|
2017-02-20 23:45:58 +00:00
|
|
|
|
* @see T25156 & r64981
|
2017-06-02 08:42:28 +00:00
|
|
|
|
* @covers Language::formatNum
|
2013-10-22 10:32:29 +00:00
|
|
|
|
*/
|
2017-06-02 08:42:28 +00:00
|
|
|
|
public function testFormatNum() {
|
|
|
|
|
|
$this->assertEquals( '1 234 567', $this->getLang()->formatNum( '1234567' ) );
|
|
|
|
|
|
$this->assertEquals( '12 345', $this->getLang()->formatNum( '12345' ) );
|
2010-12-14 16:26:35 +00:00
|
|
|
|
}
|
2013-02-15 10:27:48 +00:00
|
|
|
|
|
2013-10-22 10:32:29 +00:00
|
|
|
|
/**
|
2017-02-20 23:45:58 +00:00
|
|
|
|
* @see T25156 & r64981
|
2017-06-02 08:42:28 +00:00
|
|
|
|
* @covers Language::formatNum
|
2013-10-22 10:32:29 +00:00
|
|
|
|
*/
|
|
|
|
|
|
public function testDoesNotCommafyFourDigitsNumber() {
|
2017-06-02 08:42:28 +00:00
|
|
|
|
$this->assertSame( '1234', $this->getLang()->formatNum( '1234' ) );
|
2010-12-14 16:26:35 +00:00
|
|
|
|
}
|
2013-02-15 10:27:48 +00:00
|
|
|
|
|
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', 'many', 'other' ];
|
2012-10-23 20:53:17 +00:00
|
|
|
|
$this->assertEquals( $result, $this->getLang()->convertPlural( $value, $forms ) );
|
2012-01-27 06:01:43 +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 ],
|
|
|
|
|
|
[ 'many', 11 ],
|
|
|
|
|
|
[ 'one', 91 ],
|
|
|
|
|
|
[ 'one', 121 ],
|
|
|
|
|
|
[ 'few', 2 ],
|
|
|
|
|
|
[ 'few', 3 ],
|
|
|
|
|
|
[ 'few', 4 ],
|
|
|
|
|
|
[ 'few', 334 ],
|
|
|
|
|
|
[ 'many', 5 ],
|
|
|
|
|
|
[ 'many', 15 ],
|
|
|
|
|
|
[ 'many', 120 ],
|
|
|
|
|
|
];
|
2012-01-27 06:01:43 +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 = [ '1=one', 'other' ];
|
2012-10-23 20:53:17 +00:00
|
|
|
|
$this->assertEquals( $result, $this->getLang()->convertPlural( $value, $forms ) );
|
2012-01-27 06:01:43 +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 [
|
|
|
|
|
|
[ 'other', 0 ],
|
|
|
|
|
|
[ 'one', 1 ],
|
|
|
|
|
|
[ 'other', 11 ],
|
|
|
|
|
|
[ 'other', 91 ],
|
|
|
|
|
|
[ 'other', 121 ],
|
|
|
|
|
|
];
|
2012-01-27 06:01:43 +00:00
|
|
|
|
}
|
2010-12-14 16:26:35 +00:00
|
|
|
|
}
|