wiki.techinc.nl/tests/phpunit/includes/languages/LanguageMlTest.php
Timo Tijhof 7c39f76452 Move Language subclasses to includes/
Depending on which namespace we want these classes to have after
T166010 they could either stay in includes/languages/ (plural) in
their own MediaWiki\Languages\-namespace dedicated to Language
subclasses, or they could go in into a subdirectory like
`includes/language/languages/` if we want to keep them in the same
top-level namespace as other Language classes and services, but in
a more nested namespace.

For now, I've made the smaller change and kept the Language subclasses
in their own directory directly under includes/, not nested further.

Bug: T225756
Change-Id: I01015424707b442853879fd50c97f00215e5c2fa
2021-08-04 23:44:46 +01:00

75 lines
1.4 KiB
PHP
Raw Blame History

This file contains ambiguous Unicode characters

This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

<?php
/**
* @author Santhosh Thottingal
* @copyright Copyright © 2011, Santhosh Thottingal
* @file
*/
/**
* @group Language
* @covers LanguageMl
*/
class LanguageMlTest extends LanguageClassesTestCase {
/**
* @dataProvider provideFormatNum
* @covers Language::formatNum
*/
public function testFormatNum( $value, $result ) {
// For T31495
$this->assertEquals( $result, $this->getLang()->formatNum( $value ) );
}
public static function provideFormatNum() {
return [
[ '1234567', '12,34,567' ],
[ '12345', '12,345' ],
[ '1', '1' ],
[ '123', '123' ],
[ '1234', '1,234' ],
[ '12345.56', '12,345.56' ],
[ '12345679812345678', '12,34,56,79,81,23,45,678' ],
[ '.12345', '.12345' ],
[ '-1200000', '12,00,000' ],
[ '-98', '98' ],
[ -98, '98' ],
[ -12345678, '1,23,45,678' ],
[ '', '' ],
[ null, '' ],
];
}
/**
* @covers LanguageMl::normalize
* @covers Language::normalize
* @dataProvider provideNormalize
*/
public function testNormalize( $input, $expected ) {
if ( $input === $expected ) {
throw new Exception( 'Expected output must differ.' );
}
$this->assertSame(
$expected,
$this->getLang()->normalize( $input ),
'ml-normalised form'
);
}
public static function provideNormalize() {
return [
[
'ല്‍',
'ൽ',
],
[
'ര്‍',
'ർ',
],
[
'ള്‍',
'ൾ',
],
];
}
}