2010-12-14 16:26:35 +00:00
|
|
|
|
<?php
|
|
|
|
|
|
|
2012-10-23 20:53:17 +00:00
|
|
|
|
class LanguageBe_taraskTest extends LanguageClassesTestCase {
|
|
|
|
|
|
/**
|
|
|
|
|
|
* Make sure the language code we are given is indeed
|
|
|
|
|
|
* be-tarask. This is to ensure LanguageClassesTestCase
|
|
|
|
|
|
* does not give us the wrong language.
|
|
|
|
|
|
*/
|
|
|
|
|
|
function testBeTaraskTestsUsesBeTaraskCode() {
|
|
|
|
|
|
$this->assertEquals( 'be-tarask',
|
|
|
|
|
|
$this->getLang()->getCode()
|
|
|
|
|
|
);
|
2010-12-14 16:26:35 +00:00
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
/** see bug 23156 & r64981 */
|
|
|
|
|
|
function testSearchRightSingleQuotationMarkAsApostroph() {
|
|
|
|
|
|
$this->assertEquals(
|
|
|
|
|
|
"'",
|
2012-10-23 20:53:17 +00:00
|
|
|
|
$this->getLang()->normalizeForSearch( '’' ),
|
2010-12-14 16:26:35 +00:00
|
|
|
|
'bug 23156: U+2019 conversion to U+0027'
|
|
|
|
|
|
);
|
|
|
|
|
|
}
|
2013-02-15 10:27:48 +00:00
|
|
|
|
|
2010-12-14 16:26:35 +00:00
|
|
|
|
/** see bug 23156 & r64981 */
|
|
|
|
|
|
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
|
|
|
|
|
2010-12-14 16:26:35 +00:00
|
|
|
|
/** see bug 23156 & r64981 */
|
|
|
|
|
|
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-01-25 01:10:37 +00:00
|
|
|
|
/** @dataProvider providePlural */
|
|
|
|
|
|
function testPlural( $result, $value ) {
|
|
|
|
|
|
$forms = array( '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-01-25 01:10:37 +00:00
|
|
|
|
/** @dataProvider providePlural */
|
|
|
|
|
|
function testGetPluralRuleType( $result, $value ) {
|
|
|
|
|
|
$this->assertEquals( $result, $this->getLang()->getPluralRuleType( $value ) );
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
function providePlural() {
|
|
|
|
|
|
return array (
|
2012-01-27 06:01:43 +00:00
|
|
|
|
array( 'one', 1 ),
|
|
|
|
|
|
array( 'many', 11 ),
|
|
|
|
|
|
array( 'one', 91 ),
|
|
|
|
|
|
array( 'one', 121 ),
|
|
|
|
|
|
array( 'few', 2 ),
|
|
|
|
|
|
array( 'few', 3 ),
|
|
|
|
|
|
array( 'few', 4 ),
|
|
|
|
|
|
array( 'few', 334 ),
|
|
|
|
|
|
array( 'many', 5 ),
|
|
|
|
|
|
array( 'many', 15 ),
|
|
|
|
|
|
array( 'many', 120 ),
|
|
|
|
|
|
);
|
|
|
|
|
|
}
|
2013-02-15 10:27:48 +00:00
|
|
|
|
|
2012-01-27 06:01:43 +00:00
|
|
|
|
/** @dataProvider providePluralTwoForms */
|
|
|
|
|
|
function testPluralTwoForms( $result, $value ) {
|
2013-01-25 01:10:37 +00:00
|
|
|
|
$forms = array( '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
|
|
|
|
|
2012-01-27 06:01:43 +00:00
|
|
|
|
function providePluralTwoForms() {
|
2013-02-15 10:27:48 +00:00
|
|
|
|
return array(
|
2012-01-27 06:01:43 +00:00
|
|
|
|
array( 'one', 1 ),
|
2013-01-25 01:10:37 +00:00
|
|
|
|
array( 'other', 11 ),
|
|
|
|
|
|
array( 'other', 91 ),
|
|
|
|
|
|
array( 'other', 121 ),
|
2012-01-27 06:01:43 +00:00
|
|
|
|
);
|
|
|
|
|
|
}
|
2010-12-14 16:26:35 +00:00
|
|
|
|
}
|