added some tests using the intervals param
authorJeroen De Dauw <jeroendedauw@users.mediawiki.org>
Tue, 20 Mar 2012 22:48:28 +0000 (22:48 +0000)
committerJeroen De Dauw <jeroendedauw@users.mediawiki.org>
Tue, 20 Mar 2012 22:48:28 +0000 (22:48 +0000)
tests/phpunit/languages/LanguageTest.php

index e355a38..ff3d92e 100644 (file)
@@ -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' ),
+                       ),
                );
        }
 }