r91893 MediaWiki - Code Review archive

Repository:MediaWiki
Revision:r91892‎ | r91893 | r91894 >
Date:18:06, 11 July 2011
Author:jeroendedauw
Status:deferred
Tags:
Comment:
implemented 2 tests
Modified paths:
  • /trunk/extensions/Maps/test/MapsCoordinateParserTest.php (modified) (history)
  • /trunk/extensions/Maps/test/MapsDistanceParserTest.php (modified) (history)

Diff [purge]

Index: trunk/extensions/Maps/test/MapsCoordinateParserTest.php
@@ -7,7 +7,7 @@
88 * @since 0.6.5
99 * @author Jeroen De Dauw
1010 */
11 -class MapsCoordinateParserTest extends PHPUnit_Framework_TestCase {
 11+class MapsCoordinateParserTest extends MediaWikiTestCase {
1212
1313 /**
1414 * Valid coordinates.
Index: trunk/extensions/Maps/test/MapsDistanceParserTest.php
@@ -7,7 +7,7 @@
88 * @since 0.6.5
99 * @author Jeroen De Dauw
1010 */
11 -class MapsDistanceParserTest extends PHPUnit_Framework_TestCase {
 11+class MapsDistanceParserTest extends MediaWikiTestCase {
1212
1313 public static $distances = array(
1414 '1' => 1,
@@ -139,22 +139,27 @@
140140 * Tests MapsDistanceParser::getUnitRatio()
141141 */
142142 public function testGetUnitRatio() {
143 - // TODO Auto-generated MapsDistanceParserTest::testGetUnitRatio()
144 - $this->markTestIncomplete ( "getUnitRatio test not implemented" );
145 -
146 - MapsDistanceParser::getUnitRatio(/* parameters */);
147 -
 143+ foreach ( $GLOBALS['egMapsDistanceUnits'] as $unit => $ratio ) {
 144+ $r = MapsDistanceParser::getUnitRatio( $unit );
 145+ $this->assertEquals( $ratio, $r, "The ratio for '$unit' should be '$ratio' but was '$r'" );
 146+ }
148147 }
149148
150149 /**
151150 * Tests MapsDistanceParser::getValidUnit()
152151 */
153152 public function testGetValidUnit() {
154 - // TODO Auto-generated MapsDistanceParserTest::testGetValidUnit()
155 - $this->markTestIncomplete ( "getValidUnit test not implemented" );
 153+ foreach ( $GLOBALS['egMapsDistanceUnits'] as $unit => $ratio ) {
 154+ $u = MapsDistanceParser::getValidUnit( $unit );
 155+ $this->assertEquals( $unit, $u, "The valid unit for '$unit' should be '$unit' but was '$u'" );
 156+ }
156157
157 - MapsDistanceParser::getValidUnit(/* parameters */);
158 -
 158+ global $egMapsDistanceUnit;
 159+
 160+ foreach ( array( '0', 'swfwdffdhy', 'dxwgdrfh' ) as $unit ) {
 161+ $u = MapsDistanceParser::getValidUnit( $unit );
 162+ $this->assertEquals( $egMapsDistanceUnit, $u, "The valid unit for '$unit' should be '$egMapsDistanceUnit' but was '$u'" );
 163+ }
159164 }
160165
161166 /**