Index: trunk/phase3/tests/phpunit/languages/LanguageMlTest.php |
— | — | @@ -17,20 +17,27 @@ |
18 | 18 | } |
19 | 19 | |
20 | 20 | /** 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 ) ); |
36 | 24 | } |
| 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 | + } |
37 | 44 | } |