2010-12-14 16:26:35 +00:00
|
|
|
|
<?php
|
|
|
|
|
|
|
2014-04-24 17:52:34 +00:00
|
|
|
|
// @codingStandardsIgnoreStart Ignore Squiz.Classes.ValidClassName.NotCamelCaps
|
2017-12-28 08:24:40 +00:00
|
|
|
|
/**
|
|
|
|
|
|
* @covers LanguageBe_tarask
|
|
|
|
|
|
*/
|
2012-10-23 20:53:17 +00:00
|
|
|
|
class LanguageBe_taraskTest extends LanguageClassesTestCase {
|
2014-04-24 17:52:34 +00:00
|
|
|
|
// @codingStandardsIgnoreEnd
|
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
|
2013-10-22 10:32:29 +00:00
|
|
|
|
* @covers Language::commafy
|
|
|
|
|
|
*/
|
|
|
|
|
|
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
|
2013-10-22 10:32:29 +00:00
|
|
|
|
* @covers Language::commafy
|
|
|
|
|
|
*/
|
|
|
|
|
|
public function testCommafy() {
|
2012-10-23 20:53:17 +00:00
|
|
|
|
$this->assertEquals( '1,234,567', $this->getLang()->commafy( '1234567' ) );
|
2013-02-15 10:27:48 +00:00
|
|
|
|
$this->assertEquals( '12,345', $this->getLang()->commafy( '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
|
2013-10-22 10:32:29 +00:00
|
|
|
|
* @covers Language::commafy
|
|
|
|
|
|
*/
|
|
|
|
|
|
public function testDoesNotCommafyFourDigitsNumber() {
|
2013-02-15 10:27:48 +00:00
|
|
|
|
$this->assertEquals( '1234', $this->getLang()->commafy( '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
|
|
|
|
}
|