r91898 MediaWiki - Code Review archive

Repository:MediaWiki
Revision:r91897‎ | r91898 | r91899 >
Date:18:46, 11 July 2011
Author:jeroendedauw
Status:deferred
Tags:
Comment:
added test
Modified paths:
  • /trunk/extensions/Maps/test/MapsDistanceParserTest.php (modified) (history)

Diff [purge]

Index: trunk/extensions/Maps/test/MapsDistanceParserTest.php
@@ -83,13 +83,6 @@
8484 }
8585
8686 /**
87 - * Constructs the test case.
88 - */
89 - public function __construct() {
90 -
91 - }
92 -
93 - /**
9487 * Tests MapsDistanceParser::parseDistance()
9588 */
9689 public function testParseDistance() {
@@ -115,11 +108,15 @@
116109 * Tests MapsDistanceParser::parseAndFormat()
117110 */
118111 public function testParseAndFormat() {
119 - // TODO Auto-generated MapsDistanceParserTest::testParseAndFormat()
120 - $this->markTestIncomplete ( "parseAndFormat test not implemented" );
 112+ $conversions = array(
 113+ '42 km' => '42000 m'
 114+ );
121115
122 - MapsDistanceParser::parseAndFormat(/* parameters */);
123 -
 116+ foreach( array_merge( $conversions, array_reverse( $conversions ) ) as $source => $target ) {
 117+ $unit = explode( ' ', $target, 2 );
 118+ $unit = $unit[1];
 119+ $this->assertEquals( $target, MapsDistanceParser::parseAndFormat( $source, $unit ), "'$source' was not parsed and formatted to '$target':" );
 120+ }
124121 }
125122
126123 /**