From d42c2f4d7a689cbab0b90e30f6d2a96d8e32e96e Mon Sep 17 00:00:00 2001 From: Jeroen De Dauw Date: Tue, 20 Mar 2012 22:48:28 +0000 Subject: [PATCH] added some tests using the intervals param --- tests/phpunit/languages/LanguageTest.php | 39 ++++++++++++++++++++++-- 1 file changed, 37 insertions(+), 2 deletions(-) diff --git a/tests/phpunit/languages/LanguageTest.php b/tests/phpunit/languages/LanguageTest.php index e355a383cb..ff3d92e9e7 100644 --- a/tests/phpunit/languages/LanguageTest.php +++ b/tests/phpunit/languages/LanguageTest.php @@ -658,10 +658,10 @@ class LanguageTest extends MediaWikiTestCase { /** * @dataProvider provideFormatDuration */ - function testFormatDuration( $duration, $expected ) { + function testFormatDuration( $duration, $expected, $intervals = array() ) { $this->assertEquals( $expected, - $this->lang->formatDuration( $duration ), + $this->lang->formatDuration( $duration, $intervals ), "formatDuration('$duration'): $expected" ); } @@ -752,6 +752,41 @@ class LanguageTest extends MediaWikiTestCase { 42 * 1000 * 31557600 + 42, '42 millennia and 42 seconds' ), + array( + 60, + '60 seconds', + array( 'seconds' ), + ), + array( + 61, + '61 seconds', + array( 'seconds' ), + ), + array( + 1, + '1 second', + array( 'seconds' ), + ), + array( + 31557600 + 2 * 86400 + 9000, + '1 year, 2 days and 150 minutes', + array( 'years', 'days', 'minutes' ), + ), + array( + 42, + '0 days', + array( 'years', 'days' ), + ), + array( + 31557600 + 2 * 86400 + 9000, + '1 year, 2 days and 150 minutes', + array( 'minutes', 'days', 'years' ), + ), + array( + 42, + '0 days', + array( 'days', 'years' ), + ), ); } } -- 2.20.1