r114084 MediaWiki - Code Review archive

Repository:MediaWiki
Revision:r114083‎ | r114084 | r114085 >
Date:22:39, 17 March 2012
Author:reedy
Status:reverted
Tags:gerritmigration 
Comment:
Unit tests for r114067
Modified paths:
  • /trunk/phase3/tests/phpunit/languages/LanguageTest.php (modified) (history)

Diff [purge]

Index: trunk/phase3/tests/phpunit/languages/LanguageTest.php
@@ -654,4 +654,88 @@
655655 ),
656656 );
657657 }
 658+
 659+ /**
 660+ * @dataProvider provideFormatDuration
 661+ */
 662+ function testFormatDuration( $duration, $expected ) {
 663+ $this->assertEquals(
 664+ $expected,
 665+ $this->lang->formatDuration( $duration ),
 666+ "formatDuration('$duration'): $expected"
 667+ );
 668+ }
 669+
 670+ function provideFormatDuration() {
 671+ return array(
 672+ array(
 673+ 0,
 674+ "0 seconds",
 675+ ),
 676+ array(
 677+ 1,
 678+ "1 second",
 679+ ),
 680+ array(
 681+ 2,
 682+ "2 seconds",
 683+ ),
 684+ array(
 685+ 60,
 686+ "1 minute",
 687+ ),
 688+ array(
 689+ 2 * 60,
 690+ "2 minutes",
 691+ ),
 692+ array(
 693+ 3600,
 694+ "1 hour",
 695+ ),
 696+ array(
 697+ 2 * 3600,
 698+ "2 hours",
 699+ ),
 700+ array(
 701+ 24 * 3600,
 702+ "1 day",
 703+ ),
 704+ array(
 705+ 2 * 86400,
 706+ "2 days",
 707+ ),
 708+ array(
 709+ 365.25 * 86400,
 710+ "1 year",
 711+ ),
 712+ array(
 713+ 2 * 31557600,
 714+ "2 years",
 715+ ),
 716+ array(
 717+ 10 * 31557600,
 718+ "1 decade",
 719+ ),
 720+ array(
 721+ 2 * 10 * 31557600,
 722+ "2 decades",
 723+ ),
 724+ array(
 725+ 100 * 31557600,
 726+ "1 century",
 727+ ),
 728+ array(
 729+ 200 * 31557600,
 730+ "2 centuries",
 731+ ),
 732+ array(
 733+ 1000 * 31557600,
 734+ "1 millennium",
 735+ ),
 736+ array(
 737+ 2 * 1000 * 31557600,
 738+ "2 millennia",
 739+ ),
 740+ );
 741+ }
658742 }

Follow-up revisions

RevisionCommit summaryAuthorDate
r114086Noralise a few of the magic numbers used in r114084reedy22:47, 17 March 2012
r114089follow up to r114084, add tests for stuff w/ multiple unitsjeroendedauw23:26, 17 March 2012
r114326Revert r114067, r114071, r114075, r114079, r114081, r114082, r114084, r114086......catrope23:03, 20 March 2012

Past revisions this follows-up on

RevisionCommit summaryAuthorDate
r114067adding a duration function to language that converts seconds to textjeroendedauw20:58, 17 March 2012

Status & tagging log