X-Git-Url: https://git.heureux-cyclage.org/?p=lhc%2Fweb%2Fwiklou.git;a=blobdiff_plain;f=tests%2Fphpunit%2Flanguages%2Fclasses%2FLanguagePlTest.php;h=d7a0074397a42faf0fcfcf8957907a69706ea887;hp=a6d0f2e1cc5424f0f9e37ba7069a34ff286a08fe;hb=a8379682a46a428320c88702c800a6107c015137;hpb=a5be382adfdad4678eec18413c6a118cb3284daf diff --git a/tests/phpunit/languages/classes/LanguagePlTest.php b/tests/phpunit/languages/classes/LanguagePlTest.php index a6d0f2e1cc..d7a0074397 100644 --- a/tests/phpunit/languages/classes/LanguagePlTest.php +++ b/tests/phpunit/languages/classes/LanguagePlTest.php @@ -74,4 +74,31 @@ class LanguagePlTest extends LanguageClassesTestCase { [ 'other', 201 ], ]; } + + /** + * @covers LanguagePl::commafy() + * @dataProvider provideCommafyData + */ + public function testCommafy( $number, $numbersWithCommas ) { + $this->assertEquals( + $numbersWithCommas, + $this->getLang()->commafy( $number ), + "commafy('$number')" + ); + } + + public static function provideCommafyData() { + // Note that commafy() always uses English separators (',' and '.') instead of + // Polish (' ' and ','). There is another function that converts them later. + return [ + [ 1000, '1000' ], + [ 10000, '10,000' ], + [ 1000.0001, '1000.0001' ], + [ 10000.0001, '10,000.0001' ], + [ -1000, '-1000' ], + [ -10000, '-10,000' ], + [ -1000.0001, '-1000.0001' ], + [ -10000.0001, '-10,000.0001' ], + ]; + } }