Index: trunk/extensions/Maps/test/MapsCoordinateParserTest.php |
— | — | @@ -7,7 +7,7 @@ |
8 | 8 | * @since 0.6.5 |
9 | 9 | * @author Jeroen De Dauw |
10 | 10 | */ |
11 | | -class MapsCoordinateParserTest extends PHPUnit_Framework_TestCase { |
| 11 | +class MapsCoordinateParserTest extends MediaWikiTestCase { |
12 | 12 | |
13 | 13 | /** |
14 | 14 | * Valid coordinates. |
Index: trunk/extensions/Maps/test/MapsDistanceParserTest.php |
— | — | @@ -7,7 +7,7 @@ |
8 | 8 | * @since 0.6.5 |
9 | 9 | * @author Jeroen De Dauw |
10 | 10 | */ |
11 | | -class MapsDistanceParserTest extends PHPUnit_Framework_TestCase { |
| 11 | +class MapsDistanceParserTest extends MediaWikiTestCase { |
12 | 12 | |
13 | 13 | public static $distances = array( |
14 | 14 | '1' => 1, |
— | — | @@ -139,22 +139,27 @@ |
140 | 140 | * Tests MapsDistanceParser::getUnitRatio() |
141 | 141 | */ |
142 | 142 | 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 | + } |
148 | 147 | } |
149 | 148 | |
150 | 149 | /** |
151 | 150 | * Tests MapsDistanceParser::getValidUnit() |
152 | 151 | */ |
153 | 152 | 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 | + } |
156 | 157 | |
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 | + } |
159 | 164 | } |
160 | 165 | |
161 | 166 | /** |