7 of n.
Change-Id: I07687a4381f29fd9fc73666e460f25769ed54092
/** @dataProvider providePlural */
function testPlural( $result, $value ) {
- $forms = array( 'one', 'other' );
+ $forms = array( 'one', 'other' );
$this->assertEquals( $result, $this->getLang()->convertPlural( $value, $forms ) );
}
function providePlural() {
- return array (
+ return array(
array( 'one', 0 ),
array( 'one', 1 ),
array( 'other', 2 ),
),
);
}
+
/** @dataProvider providePlural */
function testPlural( $result, $value ) {
- $forms = array( 'zero', 'one', 'two', 'few', 'many', 'other' );
+ $forms = array( 'zero', 'one', 'two', 'few', 'many', 'other' );
$this->assertEquals( $result, $this->getLang()->convertPlural( $value, $forms ) );
}
+
function providePlural() {
- return array (
+ return array(
array( 'zero', 0 ),
array( 'one', 1 ),
array( 'two', 2 ),
/** @dataProvider providePlural */
function testPlural( $result, $value ) {
- $forms = array( 'one', 'few', 'many', 'other' );
+ $forms = array( 'one', 'few', 'many', 'other' );
$this->assertEquals( $result, $this->getLang()->convertPlural( $value, $forms ) );
}
function providePlural() {
- return array (
+ return array(
array( 'one', 1 ),
array( 'many', 11 ),
array( 'one', 91 ),
'bug 23156: U+2019 conversion to U+0027'
);
}
+
/** see bug 23156 & r64981 */
function testCommafy() {
$this->assertEquals( '1,234,567', $this->getLang()->commafy( '1234567' ) );
- $this->assertEquals( '12,345', $this->getLang()->commafy( '12345' ) );
+ $this->assertEquals( '12,345', $this->getLang()->commafy( '12345' ) );
}
+
/** see bug 23156 & r64981 */
function testDoesNotCommafyFourDigitsNumber() {
- $this->assertEquals( '1234', $this->getLang()->commafy( '1234' ) );
+ $this->assertEquals( '1234', $this->getLang()->commafy( '1234' ) );
}
+
/** @dataProvider providePluralFourForms */
function testPluralFourForms( $result, $value ) {
- $forms = array( 'one', 'few', 'many', 'other' );
+ $forms = array( 'one', 'few', 'many', 'other' );
$this->assertEquals( $result, $this->getLang()->convertPlural( $value, $forms ) );
}
function providePluralFourForms() {
- return array (
+ return array(
array( 'one', 1 ),
array( 'many', 11 ),
array( 'one', 91 ),
array( 'many', 120 ),
);
}
+
/** @dataProvider providePluralTwoForms */
function testPluralTwoForms( $result, $value ) {
- $forms = array( 'one', 'several' );
+ $forms = array( 'one', 'several' );
$this->assertEquals( $result, $this->getLang()->convertPlural( $value, $forms ) );
}
+
function providePluralTwoForms() {
- return array (
+ return array(
array( 'one', 1 ),
array( 'several', 11 ),
array( 'several', 91 ),
/** @dataProvider providePlural */
function testPlural( $result, $value ) {
- $forms = array( 'one', 'other' );
+ $forms = array( 'one', 'other' );
$this->assertEquals( $result, $this->getLang()->convertPlural( $value, $forms ) );
}
function providePlural() {
- return array (
+ return array(
array( 'one', 0 ),
array( 'one', 1 ),
array( 'other', 2 ),
/** @dataProvider providePlural */
function testPlural( $result, $value ) {
- $forms = array( 'one', 'few', 'many', 'other' );
+ $forms = array( 'one', 'few', 'many', 'other' );
$this->assertEquals( $result, $this->getLang()->convertPlural( $value, $forms ) );
}
function providePlural() {
- return array (
+ return array(
array( 'many', 0 ),
array( 'one', 1 ),
array( 'few', 2 ),
/**
* Regex used to find out the language code out of the class name
* used by setUpBeforeClass
- */
+ */
private static $reExtractLangFromClass = '/Language(.*)Test/';
/**
$m[1] = 'en';
wfDebug(
__METHOD__ . " could not extract a language name "
- . "out of " . get_called_class() . " failling back to 'en'\n"
+ . "out of " . get_called_class() . " failling back to 'en'\n"
);
}
// TODO: validate $m[1] which should be a valid language code
/** @dataProvider providerPlural */
function testPlural( $result, $value ) {
- $forms = array( 'one', 'few', 'other' );
+ $forms = array( 'one', 'few', 'other' );
$this->assertEquals( $result, $this->getLang()->convertPlural( $value, $forms ) );
}
function providerPlural() {
- return array (
+ return array(
array( 'other', 0 ),
array( 'one', 1 ),
array( 'few', 2 ),
/** @dataProvider providerPlural */
function testPlural( $result, $value ) {
- $forms = array( 'one', 'few', 'many', 'other' );
+ $forms = array( 'one', 'few', 'many', 'other' );
$this->assertEquals( $result, $this->getLang()->convertPlural( $value, $forms ) );
}
function providerPlural() {
- return array (
+ return array(
array( 'other', 0 ),
array( 'one', 1 ),
array( 'few', 2 ),
/** @dataProvider providerPlural */
function testPlural( $result, $value ) {
- $forms = array( 'zero', 'one', 'two', 'few', 'many', 'other' );
+ $forms = array( 'zero', 'one', 'two', 'few', 'many', 'other' );
$this->assertEquals( $result, $this->getLang()->convertPlural( $value, $forms ) );
}
function providerPlural() {
- return array (
+ return array(
array( 'zero', 0 ),
array( 'one', 1 ),
array( 'two', 2 ),
/** @dataProvider providePlural */
function testPlural( $result, $value ) {
- $forms = array( 'one', 'two', 'few', 'other' );
+ $forms = array( 'one', 'two', 'few', 'other' );
$this->assertEquals( $result, $this->getLang()->convertPlural( $value, $forms ) );
}
function providePlural() {
- return array (
+ return array(
array( 'other', 0 ),
array( 'one', 1 ),
array( 'one', 101 ),
/** @dataProvider providePlural */
function testPlural( $result, $value ) {
- $forms = array( 'one', 'other' );
+ $forms = array( 'one', 'other' );
$this->assertEquals( $result, $this->getLang()->convertPlural( $value, $forms ) );
}
function providePlural() {
- return array (
+ return array(
array( 'one', 0 ),
array( 'one', 1 ),
array( 'other', 2 ),
/** @dataProvider providerPlural */
function testPlural( $result, $value ) {
- $forms = array( 'one', 'two', 'other' );
+ $forms = array( 'one', 'two', 'other' );
$this->assertEquals( $result, $this->getLang()->convertPlural( $value, $forms ) );
}
function providerPlural() {
- return array (
+ return array(
array( 'other', 0 ),
array( 'one', 1 ),
array( 'two', 2 ),
/** @dataProvider providerPlural */
function testPlural( $result, $value ) {
// The CLDR ticket for this plural forms is not same as mw plural forms. See http://unicode.org/cldr/trac/ticket/2883
- $forms = array( 'Form 1', 'Form 2', 'Form 3', 'Form 4', 'Form 5', 'Form 6' );
+ $forms = array( 'Form 1', 'Form 2', 'Form 3', 'Form 4', 'Form 5', 'Form 6' );
$this->assertEquals( $result, $this->getLang()->convertPlural( $value, $forms ) );
}
+
function providerPlural() {
- return array (
+ return array(
array( 'Form 6', 0 ),
array( 'Form 1', 1 ),
array( 'Form 2', 2 ),
/** @dataProvider providerPlural */
function testPlural( $result, $value ) {
// This is not compatible with CLDR plural rules http://unicode.org/repos/cldr-tmp/trunk/diff/supplemental/language_plural_rules.html#gv
- $forms = array( 'Form 1', 'Form 2', 'Form 3', 'Form 4' );
+ $forms = array( 'Form 1', 'Form 2', 'Form 3', 'Form 4' );
$this->assertEquals( $result, $this->getLang()->convertPlural( $value, $forms ) );
}
+
function providerPlural() {
- return array (
+ return array(
array( 'Form 4', 0 ),
array( 'Form 2', 1 ),
array( 'Form 3', 2 ),
}
function providerPluralDual() {
- return array (
+ return array(
array( 'other', 0 ), // Zero -> plural
array( 'one', 1 ), // Singular
array( 'two', 2 ), // Dual
}
function providerPlural() {
- return array (
+ return array(
array( 'other', 0 ), // Zero -> plural
array( 'one', 1 ), // Singular
array( 'other', 2 ), // Plural, no dual provided
// The comments in the beginning of the line help avoid RTL problems
// with text editors.
function providerGrammar() {
- return array (
+ return array(
array(
/* result */ 'וויקיפדיה',
/* word */ 'ויקיפדיה',
/** @dataProvider providePlural */
function testPlural( $result, $value ) {
- $forms = array( 'one', 'other' );
+ $forms = array( 'one', 'other' );
$this->assertEquals( $result, $this->getLang()->convertPlural( $value, $forms ) );
}
function providePlural() {
- return array (
+ return array(
array( 'one', 0 ),
array( 'one', 1 ),
array( 'other', 2 ),
/** @dataProvider providerPlural */
function testPlural( $result, $value ) {
- $forms = array( 'one', 'few', 'many', 'other' );
+ $forms = array( 'one', 'few', 'many', 'other' );
$this->assertEquals( $result, $this->getLang()->convertPlural( $value, $forms ) );
}
function providerPlural() {
- return array (
+ return array(
array( 'many', 0 ),
array( 'one', 1 ),
array( 'few', 2 ),
/** @dataProvider providePlural */
function testPlural( $result, $value ) {
- $forms = array( 'one', 'two', 'few', 'other' );
+ $forms = array( 'one', 'two', 'few', 'other' );
$this->assertEquals( $result, $this->getLang()->convertPlural( $value, $forms ) );
}
function providePlural() {
- return array (
+ return array(
array( 'other', 0 ),
array( 'one', 1 ),
array( 'one', 101 ),
}
function providePlural() {
- return array (
+ return array(
array( 'other', 0 ),
array( 'one', 1 ),
array( 'other', 2 ),
/** @dataProvider providerPlural */
function testPlural( $result, $value ) {
- $forms = array( 'one', 'other' );
+ $forms = array( 'one', 'other' );
$this->assertEquals( $result, $this->getLang()->convertPlural( $value, $forms ) );
}
function providerPlural() {
- return array (
+ return array(
array( 'other', 0 ),
array( 'one', 1 ),
array( 'other', 2 ),
/** @dataProvider providerPlural */
function testPlural( $result, $value ) {
- $forms = array( 'one', 'other', 'zero' );
+ $forms = array( 'one', 'other', 'zero' );
$this->assertEquals( $result, $this->getLang()->convertPlural( $value, $forms ) );
}
function providerPlural() {
- return array (
+ return array(
array( 'zero', 0 ),
array( 'one', 1 ),
array( 'other', 2 ),
/** @dataProvider providePlural */
function testPlural( $result, $value ) {
- $forms = array( 'one', 'other' );
+ $forms = array( 'one', 'other' );
$this->assertEquals( $result, $this->getLang()->convertPlural( $value, $forms ) );
}
function providePlural() {
- return array (
+ return array(
array( 'one', 0 ),
array( 'one', 1 ),
array( 'other', 2 ),
/** @dataProvider provideOneFewOtherCases */
function testOneFewOtherPlural( $result, $value ) {
- $forms = array( 'one', 'few', 'other' );
+ $forms = array( 'one', 'few', 'other' );
$this->assertEquals( $result, $this->getLang()->convertPlural( $value, $forms ) );
}
-
+
/** @dataProvider provideOneFewCases */
function testOneFewPlural( $result, $value ) {
- $forms = array( 'one', 'few' );
+ $forms = array( 'one', 'few' );
$this->assertEquals( $result, $this->getLang()->convertPlural( $value, $forms ) );
}
function provideOneFewOtherCases() {
- return array (
+ return array(
array( 'other', 0 ),
array( 'one', 1 ),
array( 'few', 2 ),
array( 'one', 40001 ),
);
}
-
+
function provideOneFewCases() {
- return array (
+ return array(
array( 'one', 1 ),
array( 'few', 15 ),
);
/** @dataProvider providerPlural */
function testPlural( $result, $value ) {
- $forms = array( 'one', 'other' );
+ $forms = array( 'one', 'other' );
$this->assertEquals( $result, $this->getLang()->convertPlural( $value, $forms ) );
}
function providerPlural() {
- return array (
+ return array(
array( 'other', 0 ), #this must be zero form as per CLDR
array( 'one', 1 ),
array( 'other', 11 ),
/** @dataProvider providePlural */
function testPlural( $result, $value ) {
- $forms = array( 'one', 'other' );
+ $forms = array( 'one', 'other' );
$this->assertEquals( $result, $this->getLang()->convertPlural( $value, $forms ) );
}
function providePlural() {
- return array (
+ return array(
array( 'one', 0 ),
array( 'one', 1 ),
array( 'other', 2 ),
/** @dataProvider providerPlural */
function testPlural( $result, $value ) {
- $forms = array( 'one', 'other' );
+ $forms = array( 'one', 'other' );
$this->assertEquals( $result, $this->getLang()->convertPlural( $value, $forms ) );
}
function providerPlural() {
- return array (
+ return array(
array( 'other', 0 ),
array( 'one', 1 ),
array( 'other', 11 ),
class LanguageMlTest extends LanguageClassesTestCase {
/** see bug 29495 */
- /** @dataProvider providerFormatNum*/
+ /** @dataProvider providerFormatNum */
function testFormatNum( $result, $value ) {
$this->assertEquals( $result, $this->getLang()->formatNum( $value ) );
}
function providerFormatNum() {
return array(
- array( '12,34,567', '1234567' ),
+ array( '12,34,567', '1234567' ),
array( '12,345', '12345' ),
array( '1', '1' ),
- array( '123', '123' ) ,
+ array( '123', '123' ),
array( '1,234', '1234' ),
array( '12,345.56', '12345.56' ),
array( '12,34,56,79,81,23,45,678', '12345679812345678' ),
array( '-12,00,000', '-1200000' ),
array( '-98', '-98' ),
array( '-98', -98 ),
- array( '-1,23,45,678', -12345678 ),
+ array( '-1,23,45,678', -12345678 ),
array( '', '' ),
array( '', null ),
);
/** @dataProvider providerPlural */
function testPlural( $result, $value ) {
- $forms = array( 'one', 'few', 'other' );
+ $forms = array( 'one', 'few', 'other' );
$this->assertEquals( $result, $this->getLang()->convertPlural( $value, $forms ) );
}
function providerPlural() {
- return array (
- array( 'few', 0 ),
- array( 'one', 1 ),
- array( 'few', 2 ),
- array( 'few', 19 ),
+ return array(
+ array( 'few', 0 ),
+ array( 'one', 1 ),
+ array( 'few', 2 ),
+ array( 'few', 19 ),
array( 'other', 20 ),
array( 'other', 99 ),
array( 'other', 100 ),
- array( 'few', 101 ),
- array( 'few', 119 ),
+ array( 'few', 101 ),
+ array( 'few', 119 ),
array( 'other', 120 ),
array( 'other', 200 ),
- array( 'few', 201 ),
- array( 'few', 219 ),
+ array( 'few', 201 ),
+ array( 'few', 219 ),
array( 'other', 220 ),
);
}
}
function providerPluralAllForms() {
- return array (
- array( 'few', 0 ),
- array( 'one', 1 ),
- array( 'few', 2 ),
- array( 'few', 10 ),
- array( 'many', 11 ),
- array( 'many', 19 ),
+ return array(
+ array( 'few', 0 ),
+ array( 'one', 1 ),
+ array( 'few', 2 ),
+ array( 'few', 10 ),
+ array( 'many', 11 ),
+ array( 'many', 19 ),
array( 'other', 20 ),
array( 'other', 99 ),
array( 'other', 100 ),
array( 'other', 101 ),
- array( 'few', 102 ),
- array( 'few', 110 ),
- array( 'many', 111 ),
- array( 'many', 119 ),
+ array( 'few', 102 ),
+ array( 'few', 110 ),
+ array( 'many', 111 ),
+ array( 'many', 119 ),
array( 'other', 120 ),
array( 'other', 201 ),
);
}
function providerPluralTwoForms() {
- return array (
- array( 'many', 0 ),
- array( 'one', 1 ),
- array( 'many', 2 ),
- array( 'many', 10 ),
- array( 'many', 11 ),
- array( 'many', 19 ),
- array( 'many', 20 ),
- array( 'many', 99 ),
- array( 'many', 100 ),
- array( 'many', 101 ),
- array( 'many', 102 ),
- array( 'many', 110 ),
- array( 'many', 111 ),
- array( 'many', 119 ),
- array( 'many', 120 ),
- array( 'many', 201 ),
+ return array(
+ array( 'many', 0 ),
+ array( 'one', 1 ),
+ array( 'many', 2 ),
+ array( 'many', 10 ),
+ array( 'many', 11 ),
+ array( 'many', 19 ),
+ array( 'many', 20 ),
+ array( 'many', 99 ),
+ array( 'many', 100 ),
+ array( 'many', 101 ),
+ array( 'many', 102 ),
+ array( 'many', 110 ),
+ array( 'many', 111 ),
+ array( 'many', 119 ),
+ array( 'many', 120 ),
+ array( 'many', 201 ),
);
}
}
}
function providerPlural() {
- return array (
- array( 'one', 0 ),
- array( 'one', 1 ),
+ return array(
+ array( 'one', 0 ),
+ array( 'one', 1 ),
array( 'many', 2 ),
);
}
}
function providerPluralFourForms() {
- return array (
- array( 'many', 0 ),
- array( 'one', 1 ),
- array( 'few', 2 ),
- array( 'few', 3 ),
- array( 'few', 4 ),
- array( 'many', 5 ),
- array( 'many', 9 ),
- array( 'many', 10 ),
- array( 'many', 11 ),
- array( 'many', 21 ),
- array( 'few', 22 ),
- array( 'few', 23 ),
- array( 'few', 24 ),
- array( 'many', 25 ),
- array( 'many', 200 ),
- array( 'many', 201 ),
+ return array(
+ array( 'many', 0 ),
+ array( 'one', 1 ),
+ array( 'few', 2 ),
+ array( 'few', 3 ),
+ array( 'few', 4 ),
+ array( 'many', 5 ),
+ array( 'many', 9 ),
+ array( 'many', 10 ),
+ array( 'many', 11 ),
+ array( 'many', 21 ),
+ array( 'few', 22 ),
+ array( 'few', 23 ),
+ array( 'few', 24 ),
+ array( 'many', 25 ),
+ array( 'many', 200 ),
+ array( 'many', 201 ),
);
}
}
function providerPlural() {
- return array (
- array( 'many', 0 ),
- array( 'one', 1 ),
- array( 'many', 2 ),
- array( 'many', 3 ),
- array( 'many', 4 ),
- array( 'many', 5 ),
- array( 'many', 9 ),
- array( 'many', 10 ),
- array( 'many', 11 ),
- array( 'many', 21 ),
- array( 'many', 22 ),
- array( 'many', 23 ),
- array( 'many', 24 ),
- array( 'many', 25 ),
- array( 'many', 200 ),
- array( 'many', 201 ),
+ return array(
+ array( 'many', 0 ),
+ array( 'one', 1 ),
+ array( 'many', 2 ),
+ array( 'many', 3 ),
+ array( 'many', 4 ),
+ array( 'many', 5 ),
+ array( 'many', 9 ),
+ array( 'many', 10 ),
+ array( 'many', 11 ),
+ array( 'many', 21 ),
+ array( 'many', 22 ),
+ array( 'many', 23 ),
+ array( 'many', 24 ),
+ array( 'many', 25 ),
+ array( 'many', 200 ),
+ array( 'many', 201 ),
);
}
}
/** @dataProvider providerPlural */
function testPlural( $result, $value ) {
- $forms = array( 'one', 'few', 'other' );
+ $forms = array( 'one', 'few', 'other' );
$this->assertEquals( $result, $this->getLang()->convertPlural( $value, $forms ) );
}
function providerPlural() {
- return array (
- array( 'few', 0 ),
- array( 'one', 1 ),
- array( 'few', 2 ),
- array( 'few', 19 ),
+ return array(
+ array( 'few', 0 ),
+ array( 'one', 1 ),
+ array( 'few', 2 ),
+ array( 'few', 19 ),
array( 'other', 20 ),
array( 'other', 99 ),
array( 'other', 100 ),
- array( 'few', 101 ),
- array( 'few', 119 ),
+ array( 'few', 101 ),
+ array( 'few', 119 ),
array( 'other', 120 ),
array( 'other', 200 ),
- array( 'few', 201 ),
- array( 'few', 219 ),
+ array( 'few', 201 ),
+ array( 'few', 219 ),
array( 'other', 220 ),
);
}
}
function providerPluralThreeForms() {
- return array (
+ return array(
array( 'other', 0 ),
- array( 'one', 1 ),
- array( 'two', 2 ),
+ array( 'one', 1 ),
+ array( 'two', 2 ),
array( 'other', 3 ),
);
}
}
function providerPlural() {
- return array (
+ return array(
array( 'other', 0 ),
- array( 'one', 1 ),
+ array( 'one', 1 ),
array( 'other', 2 ),
array( 'other', 3 ),
);
}
function providePluralAllForms() {
- return array (
- array( 'many', 0 ),
- array( 'one', 1 ),
- array( 'few', 2 ),
+ return array(
+ array( 'many', 0 ),
+ array( 'one', 1 ),
+ array( 'few', 2 ),
array( 'other', 3 ),
- array( 'many', 10 ),
- array( 'many', 11 ),
- array( 'many', 12 ),
- array( 'many', 19 ),
+ array( 'many', 10 ),
+ array( 'many', 11 ),
+ array( 'many', 12 ),
+ array( 'many', 19 ),
array( 'other', 20 ),
- array( 'many', 100 ),
- array( 'one', 101 ),
- array( 'many', 111 ),
- array( 'many', 112 ),
+ array( 'many', 100 ),
+ array( 'one', 101 ),
+ array( 'many', 111 ),
+ array( 'many', 112 ),
);
}
/** @dataProvider providePluralTwoForms */
function testPluralTwoForms( $result, $value ) {
- $forms = array( 'one', 'other' );
+ $forms = array( 'one', 'other' );
$this->assertEquals( $result, $this->getLang()->convertPlural( $value, $forms ) );
}
function providePluralTwoForms() {
- return array (
+ return array(
array( 'other', 0 ),
- array( 'one', 1 ),
+ array( 'one', 1 ),
array( 'other', 2 ),
array( 'other', 3 ),
array( 'other', 10 ),
array( 'other', 19 ),
array( 'other', 20 ),
array( 'other', 100 ),
- array( 'one', 101 ),
+ array( 'one', 101 ),
array( 'other', 111 ),
array( 'other', 112 ),
);
}
function providerPlural() {
- return array (
+ return array(
array( 'many', 0 ),
- array( 'one', 1 ),
+ array( 'one', 1 ),
array( 'many', 2 ),
);
}
}
function providerPlural() {
- return array (
+ return array(
array( 'other', 0 ),
array( 'one', 1 ),
array( 'few', 2 ),
}
function providerPlural() {
- return array (
- array( 'zero', 0 ),
- array( 'one', 1 ),
- array( 'two', 2 ),
- array( 'few', 3 ),
- array( 'few', 4 ),
+ return array(
+ array( 'zero', 0 ),
+ array( 'one', 1 ),
+ array( 'two', 2 ),
+ array( 'few', 3 ),
+ array( 'few', 4 ),
array( 'other', 5 ),
array( 'other', 99 ),
array( 'other', 100 ),
- array( 'one', 101 ),
- array( 'two', 102 ),
- array( 'few', 103 ),
- array( 'one', 201 ),
+ array( 'one', 101 ),
+ array( 'two', 102 ),
+ array( 'few', 103 ),
+ array( 'one', 201 ),
);
}
}
}
function providerPluralThreeForms() {
- return array (
+ return array(
array( 'other', 0 ),
- array( 'one', 1 ),
- array( 'two', 2 ),
+ array( 'one', 1 ),
+ array( 'two', 2 ),
array( 'other', 3 ),
);
}
}
function providerPlural() {
- return array (
+ return array(
array( 'other', 0 ),
- array( 'one', 1 ),
+ array( 'one', 1 ),
array( 'other', 2 ),
array( 'other', 3 ),
);
##### TESTS #######################################################
- function testEasyConversions( ) {
+ function testEasyConversions() {
$this->assertCyrillic(
'шђчћжШЂЧЋЖ',
'Cyrillic guessing characters'
}
function providePluralFourForms() {
- return array (
+ return array(
array( 'one', 1 ),
array( 'many', 11 ),
array( 'one', 91 ),
array( 'many', 120 ),
);
}
+
/** @dataProvider providePluralTwoForms */
function testPluralTwoForms( $result, $value ) {
$forms = array( 'one', 'several' );
$this->assertEquals( $result, $this->getLang()->convertPlural( $value, $forms ) );
}
+
function providePluralTwoForms() {
- return array (
+ return array(
array( 'one', 1 ),
array( 'several', 11 ),
array( 'several', 91 ),
$msg
);
}
+
/**
* Wrapper to verify a text is different once converted to a variant.
* @param $text string Text to convert
$this->assertUnConverted( $text, 'sr-ec', $msg );
$this->assertConverted( $text, 'sr-el', $msg );
}
+
/**
* Verifiy the given Latin text is not converted when using
* using the Latin variant and converted to Cyrillic when using
return $this->getLang()
->mConverter
->convertTo(
- $text, $variant
- );
+ $text, $variant
+ );
}
+
function convertToCyrillic( $text ) {
return $this->convertTo( $text, 'sr-ec' );
}
+
function convertToLatin( $text ) {
return $this->convertTo( $text, 'sr-el' );
}
function provideLanguageCodes() {
return array(
- array( 'fr' , 'Two letters, minor case' ),
- array( 'EN' , 'Two letters, upper case' ),
- array( 'tyv' , 'Three letters' ),
- array( 'tokipona' , 'long language code' ),
+ array( 'fr', 'Two letters, minor case' ),
+ array( 'EN', 'Two letters, upper case' ),
+ array( 'tyv', 'Three letters' ),
+ array( 'tokipona', 'long language code' ),
array( 'be-tarask', 'With dash' ),
array( 'Zh-classical', 'Begin with upper case, dash' ),
array( 'Be-x-old', 'With extension (two dashes)' ),
*/
function testKnownLanguageTag( $code, $message = '' ) {
$this->assertTrue(
- (bool) Language::isKnownLanguageTag( $code ),
+ (bool)Language::isKnownLanguageTag( $code ),
"validating code $code - $message"
);
}
}
$this->assertTrue(
- (bool) Language::isKnownLanguageTag( 'pal' ),
+ (bool)Language::isKnownLanguageTag( 'pal' ),
'validating code "pal" an ancient language, which probably will not appear in Names.php, but appears in CLDR in English'
);
}
*/
function testUnknownLanguageTag( $code, $message = '' ) {
$this->assertFalse(
- (bool) Language::isKnownLanguageTag( $code ),
+ (bool)Language::isKnownLanguageTag( $code ),
"checking that code $code is invalid - $message"
);
}
"sprintfDate('$format', '$ts'): $msg"
);
}
+
/**
* bug 33454. sprintfDate should always use UTC.
* @dataProvider provideSprintfDateSamples
}
-
/**
* @dataProvider provideFormatDuration
*/
function testCheckTitleEncoding( $s ) {
$this->assertEquals(
$s,
- $this->getLang()->checkTitleEncoding($s),
+ $this->getLang()->checkTitleEncoding( $s ),
"checkTitleEncoding('$s')"
);
}
function provideCheckTitleEncodingData() {
- return array (
+ return array(
array( "" ),
array( "United States of America" ), // 7bit ASCII
array( rawurldecode( "S%C3%A9rie%20t%C3%A9l%C3%A9vis%C3%A9e" ) ),
array( 7000, 'MMMMMMM' ),
array( 8000, 'MMMMMMMM' ),
array( 9000, 'MMMMMMMMM' ),
- array( 9999, 'MMMMMMMMMCMXCIX'),
+ array( 9999, 'MMMMMMMMMCMXCIX' ),
array( 10000, 'MMMMMMMMMM' ),
);
}
$s = $lang->getMessageFromDB( 'word-separator' );
$c = $lang->getMessageFromDB( 'comma-separator' );
- $this->assertEquals( '', $lang->listToText( array( ) ) );
+ $this->assertEquals( '', $lang->listToText( array() ) );
$this->assertEquals( 'a', $lang->listToText( array( 'a' ) ) );
$this->assertEquals( "a{$and}{$s}b", $lang->listToText( array( 'a', 'b' ) ) );
$this->assertEquals( "a{$c}b{$and}{$s}c", $lang->listToText( array( 'a', 'b', 'c' ) ) );
}
function providerPlural() {
- return array (
- array( 'one', 0 ),
- array( 'one', 1 ),
+ return array(
+ array( 'one', 0 ),
+ array( 'one', 1 ),
array( 'many', 2 ),
);
}
}
function providerPlural() {
- return array (
- array( 'one', 0 ),
- array( 'one', 1 ),
+ return array(
+ array( 'one', 0 ),
+ array( 'one', 1 ),
array( 'many', 2 ),
);
}
* @dataProvider provideDottedAndDotlessI
*/
function testDottedAndDotlessI( $func, $input, $inputCase, $expected ) {
- if( $func == 'ucfirst' ) {
+ if ( $func == 'ucfirst' ) {
$res = $this->getLang()->ucfirst( $input );
- } elseif( $func == 'lcfirst' ) {
+ } elseif ( $func == 'lcfirst' ) {
$res = $this->getLang()->lcfirst( $input );
} else {
throw new MWException( __METHOD__ . " given an invalid function name '$func'" );
}
function providePluralFourForms() {
- return array (
+ return array(
array( 'one', 1 ),
array( 'many', 11 ),
array( 'one', 91 ),
array( 'many', 120 ),
);
}
+
/** @dataProvider providePluralTwoForms */
function testPluralTwoForms( $result, $value ) {
$forms = array( 'one', 'several' );
$this->assertEquals( $result, $this->getLang()->convertPlural( $value, $forms ) );
}
+
function providePluralTwoForms() {
- return array (
+ return array(
array( 'one', 1 ),
array( 'several', 11 ),
array( 'several', 91 ),
$msg
);
}
+
/**
* Wrapper to verify a text is different once converted to a variant.
* @param $text string Text to convert
$this->assertUnConverted( $text, 'uz-cyrl', $msg );
$this->assertConverted( $text, 'uz-latn', $msg );
}
+
/**
* Verifiy the given Latin text is not converted when using
* using the Latin variant and converted to Cyrillic when using
function convertTo( $text, $variant ) {
return $this->getLang()->mConverter->convertTo( $text, $variant );
}
+
function convertToCyrillic( $text ) {
return $this->convertTo( $text, 'uz-cyrl' );
}
+
function convertToLatin( $text ) {
return $this->convertTo( $text, 'uz-latn' );
}
}
function providerPlural() {
- return array (
- array( 'one', 0 ),
- array( 'one', 1 ),
+ return array(
+ array( 'one', 0 ),
+ array( 'one', 1 ),
array( 'many', 2 ),
);
}