r110102 MediaWiki - Code Review archive

Repository:MediaWiki
Revision:r110101‎ | r110102 | r110103 >
Date:05:58, 27 January 2012
Author:santhosh
Status:ok (Comments)
Tags:i18nreview 
Comment:
Use dataprovider for testcases.
Modified paths:
  • /trunk/phase3/tests/phpunit/languages/LanguageMlTest.php (modified) (history)

Diff [purge]

Index: trunk/phase3/tests/phpunit/languages/LanguageMlTest.php
@@ -17,20 +17,27 @@
1818 }
1919
2020 /** see bug 29495 */
21 - function testFormatNum() {
22 - $this->assertEquals( '12,34,567', $this->lang->formatNum( '1234567' ) );
23 - $this->assertEquals( '12,345', $this->lang->formatNum( '12345' ) );
24 - $this->assertEquals( '1', $this->lang->formatNum( '1' ) );
25 - $this->assertEquals( '123', $this->lang->formatNum( '123' ) );
26 - $this->assertEquals( '1,234', $this->lang->formatNum( '1234' ) );
27 - $this->assertEquals( '12,345.56', $this->lang->formatNum( '12345.56' ) );
28 - $this->assertEquals( '12,34,56,79,81,23,45,678', $this->lang->formatNum( '12345679812345678' ) );
29 - $this->assertEquals( '.12345', $this->lang->formatNum( '.12345' ) );
30 - $this->assertEquals( '-12,00,000', $this->lang->formatNum( '-1200000' ) );
31 - $this->assertEquals( '-98', $this->lang->formatNum( '-98' ) );
32 - $this->assertEquals( '-98', $this->lang->formatNum( -98 ) );
33 - $this->assertEquals( '-1,23,45,678', $this->lang->formatNum( -12345678 ) );
34 - $this->assertEquals( '', $this->lang->formatNum( '' ) );
35 - $this->assertEquals( '', $this->lang->formatNum( null ) );
 21+ /** @dataProvider providerFormatNum*/
 22+ function testFormatNum( $result, $value ) {
 23+ $this->assertEquals( $result, $this->lang->formatNum( $value ) );
3624 }
 25+
 26+ function providerFormatNum() {
 27+ return array(
 28+ array( '12,34,567', '1234567' ),
 29+ array( '12,345', '12345' ),
 30+ array( '1', '1' ),
 31+ array( '123', '123' ) ,
 32+ array( '1,234', '1234' ),
 33+ array( '12,345.56', '12345.56' ),
 34+ array( '12,34,56,79,81,23,45,678', '12345679812345678' ),
 35+ array( '.12345', '.12345' ),
 36+ array( '-12,00,000', '-1200000' ),
 37+ array( '-98', '-98' ),
 38+ array( '-98', -98 ),
 39+ array( '-1,23,45,678', -12345678 ),
 40+ array( '', '' ),
 41+ array( '', null ),
 42+ );
 43+ }
3744 }

Comments

#Comment by Nikerabbit (talk | contribs)   07:55, 27 January 2012

assertEquals and -12345678 lines have double space.

Status & tagging log