Skip to content

Commit

Permalink
Merge pull request #231 from JeroenDeDauw/rename
Browse files Browse the repository at this point in the history
Corrected name of geocoding adapter
  • Loading branch information
JeroenDeDauw committed Sep 13, 2016
2 parents 632d955 + 4e66d22 commit 7567178
Show file tree
Hide file tree
Showing 3 changed files with 10 additions and 7 deletions.
4 changes: 2 additions & 2 deletions includes/Geocoders.php
Expand Up @@ -5,7 +5,7 @@
use DataValues\Geo\Formatters\GeoCoordinateFormatter;
use DataValues\Geo\Parsers\GeoCoordinateParser;
use DataValues\Geo\Values\LatLongValue;
use MapsDecoratedGeocoder;
use MapsOldGeocoderAdapter;
use MWException;
use ValueParsers\ParseException;

Expand Down Expand Up @@ -351,7 +351,7 @@ protected static function getGeocoderInstance( $geocoderIdentifier ) {
$geocoder = new self::$registeredGeocoders[$geocoderIdentifier]( $geocoderIdentifier );
}
elseif ( self::$registeredGeocoders[$geocoderIdentifier] instanceof \Maps\Geocoders\Geocoder ) {
$geocoder = new MapsDecoratedGeocoder(
$geocoder = new MapsOldGeocoderAdapter(
self::$registeredGeocoders[$geocoderIdentifier],
$geocoderIdentifier
);
Expand Down
Expand Up @@ -3,12 +3,15 @@
use Maps\Geocoders\Geocoder;

/**
* Adapts the new Maps\Geocoders\Geocoder interface to the legacy
* Maps\Geocoder class hierarchy.
*
* @since 3.8
*
* @licence GNU GPL v2+
* @author Jeroen De Dauw < jeroendedauw@gmail.com >
*/
final class MapsDecoratedGeocoder extends \Maps\Geocoder {
final class MapsOldGeocoderAdapter extends \Maps\Geocoder {

private $geocoder;

Expand Down
Expand Up @@ -8,21 +8,21 @@
use Maps\Geocoders\NominatimGeocoder;

/**
* @covers MapsDecoratedGeocoder
* @covers MapsOldGeocoderAdapter
*
* @group Maps
*
* @licence GNU GPL v2+
* @author Jeroen De Dauw < jeroendedauw@gmail.com >
*/
class DecoratedGeocoderTest extends \PHPUnit_Framework_TestCase {
class MapsOldGeocoderAdapterTest extends \PHPUnit_Framework_TestCase {

public function testWhenInnerGeocoderHasResult_itGetsReturnedInArrayForm() {
$geocoder = new InMemoryGeocoder( [
'New York' => new LatLongValue( 40.7642499, -73.9545249 )
] );

$decoratedGeocoder = new \MapsDecoratedGeocoder( $geocoder, 'maw' );
$decoratedGeocoder = new \MapsOldGeocoderAdapter( $geocoder, 'maw' );

$this->assertSame(
[
Expand All @@ -38,7 +38,7 @@ public function testWhenInnerGeocoderHasNoResult_falseIsReturned() {
'New York' => new LatLongValue( 40.7642499, -73.9545249 )
] );

$decoratedGeocoder = new \MapsDecoratedGeocoder( $geocoder, 'maw' );
$decoratedGeocoder = new \MapsOldGeocoderAdapter( $geocoder, 'maw' );

$this->assertFalse( $decoratedGeocoder->geocode( 'durkadurkastan' ) );
}
Expand Down

0 comments on commit 7567178

Please sign in to comment.