wiki.techinc.nl/tests/phpunit/includes/languages/LanguageMlTest.php
thiemowmde ea2f0b651e Replace generic new Exception with more generic ones
… or with $this->fail() from the PHPUnit TestCase base class.

I hope this makes the code more readable, i.e. communicate the
intention better. The output should be the same, i.e. the test fails
as before in case of an error.

Change-Id: Ied8a045141ac92d6af6398682bb5d9ca7ca88c49
2023-10-17 07:59:50 +00: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 ) {
$this->fail( 'Expected output must differ.' );
}
$this->assertSame(
$expected,
$this->getLang()->normalize( $input ),
'ml-normalised form'
);
}
public static function provideNormalize() {
return [
[
'ല്‍',
'ൽ',
],
[
'ര്‍',
'ർ',
],
[
'ള്‍',
'ൾ',
],
];
}
}