r107734 MediaWiki - Code Review archive

Repository:MediaWiki
Revision:r107733‎ | r107734 | r107735 >
Date:20:30, 31 December 2011
Author:reedy
Status:resolved
Tags:
Comment:
Start adding tests for Language::formatBitrate()

1Gbps commented out as for some reason it's returning 1.1Gbps...
Modified paths:
  • /trunk/phase3/tests/phpunit/languages/LanguageTest.php (modified) (history)

Diff [purge]

Index: trunk/phase3/tests/phpunit/languages/LanguageTest.php
@@ -286,4 +286,46 @@
287287 // How big!? THIS BIG!
288288 );
289289 }
 290+
 291+ /**
 292+ * @dataProvider provideFormatBitrate
 293+ */
 294+ function testFormatBitrate( $bps, $expected, $msg ) {
 295+ $this->assertEquals(
 296+ $expected,
 297+ $this->lang->formatBitrate( $bps ),
 298+ "formatBitrate('$bps'): $msg"
 299+ );
 300+ }
 301+
 302+ function provideFormatBitrate() {
 303+ return array(
 304+ array(
 305+ 0,
 306+ "0bps",
 307+ "0 bytes per second"
 308+ ),
 309+ array(
 310+ 1024,
 311+ "1kbps",
 312+ "1 kilobyte per second"
 313+ ),
 314+ array(
 315+ 1024 * 1024,
 316+ "1Mbps",
 317+ "1 megabyte per second"
 318+ ),
 319+ // Test commented out as currently resulting in 1.1Gbps
 320+// array(
 321+// 1024 * 1024 * 1024,
 322+// "1Gbps",
 323+// "1 gigabyte per second"
 324+// ),
 325+ array(
 326+ 1024 * 1024 * 1024 * 1024,
 327+ "1,024Gbps",
 328+ "1,024 gigabytes per second"
 329+ ),
 330+ );
 331+ }
290332 }

Follow-up revisions

RevisionCommit summaryAuthorDate
r107735bug 33014 and r107734...reedy20:35, 31 December 2011
r107739Shut up Jenkins!...reedy21:01, 31 December 2011
r107751Fixup and add rest of tests...reedy22:30, 31 December 2011

Status & tagging log