jenkins-bot has submitted this change and it was merged.

Change subject: Introduced GlobeCoordinateParser
......................................................................


Introduced GlobeCoordinateParser

This new parser has the same behaviour as the old GeoCoordinateParser.
Now, the latter returns a simple LatLongValue and no longer does precision
detection. Existing behaviour of this component should not have changed
visibly to the outside.

Change-Id: I20012795ced95e8afda7f2c21fd32730dc408432
---
M ValueParsers/ValueParsers.classes.php
M ValueParsers/ValueParsers.php
M ValueParsers/includes/parsers/DdCoordinateParser.php
M ValueParsers/includes/parsers/DmCoordinateParser.php
M ValueParsers/includes/parsers/DmsCoordinateParser.php
M ValueParsers/includes/parsers/FloatCoordinateParser.php
M ValueParsers/includes/parsers/GeoCoordinateParser.php
M ValueParsers/includes/parsers/GeoCoordinateParserBase.php
A ValueParsers/includes/parsers/GlobeCoordinateParser.php
M ValueParsers/tests/phpunit/api/ApiParseValueTest.php
M ValueParsers/tests/phpunit/parsers/DdCoordinateParserTest.php
M ValueParsers/tests/phpunit/parsers/DmCoordinateParserTest.php
M ValueParsers/tests/phpunit/parsers/DmsCoordinateParserTest.php
M ValueParsers/tests/phpunit/parsers/FloatCoordinateParserTest.php
M ValueParsers/tests/phpunit/parsers/GeoCoordinateParserTest.php
A ValueParsers/tests/phpunit/parsers/GlobeCoordinateParserTest.php
16 files changed, 420 insertions(+), 276 deletions(-)

Approvals:
  Henning Snater: Looks good to me, approved
  jenkins-bot: Verified



diff --git a/ValueParsers/ValueParsers.classes.php 
b/ValueParsers/ValueParsers.classes.php
index 3e37476..756e007 100644
--- a/ValueParsers/ValueParsers.classes.php
+++ b/ValueParsers/ValueParsers.classes.php
@@ -26,6 +26,7 @@
        'ValueParsers\FloatCoordinateParser' => 
'includes/parsers/FloatCoordinateParser.php',
        'ValueParsers\GeoCoordinateParser' => 
'includes/parsers/GeoCoordinateParser.php',
        'ValueParsers\GeoCoordinateParserBase' => 
'includes/parsers/GeoCoordinateParserBase.php',
+       'ValueParsers\GlobeCoordinateParser' => 
'includes/parsers/GlobeCoordinateParser.php',
        'ValueParsers\FloatParser' => 'includes/parsers/FloatParser.php',
        'ValueParsers\IntParser' => 'includes/parsers/IntParser.php',
        'ValueParsers\NullParser' => 'includes/parsers/NullParser.php',
diff --git a/ValueParsers/ValueParsers.php b/ValueParsers/ValueParsers.php
index 06b2571..73e3abb 100644
--- a/ValueParsers/ValueParsers.php
+++ b/ValueParsers/ValueParsers.php
@@ -46,7 +46,7 @@
 
 $wgValueParsers['bool'] = 'ValueParsers\BoolParser';
 $wgValueParsers['float'] = 'ValueParsers\FloatParser';
-$wgValueParsers['globecoordinate'] = 'ValueParsers\GeoCoordinateParser';
+$wgValueParsers['globecoordinate'] = 'ValueParsers\GlobeCoordinateParser';
 $wgValueParsers['int'] = 'ValueParsers\IntParser';
 $wgValueParsers['null'] = 'ValueParsers\NullParser';
 
diff --git a/ValueParsers/includes/parsers/DdCoordinateParser.php 
b/ValueParsers/includes/parsers/DdCoordinateParser.php
index c6f0a87..1789236 100644
--- a/ValueParsers/includes/parsers/DdCoordinateParser.php
+++ b/ValueParsers/includes/parsers/DdCoordinateParser.php
@@ -46,22 +46,6 @@
        }
 
        /**
-        * @see GeoCoordinateParserBase::detectPrecision
-        */
-       protected function detectPrecision( $number ) {
-               // TODO: Implement localized decimal separator.
-               $split = explode( '.', $number );
-
-               $precision = 1;
-
-               if( isset( $split[1] ) ) {
-                       $precision = pow( 10, -1 * strlen( $split[1] ) );
-               }
-
-               return $precision;
-       }
-
-       /**
         * @see GeoCoordinateParserBase::areValidCoordinates
         */
        protected function areValidCoordinates( $normalizedCoordinateSegments ) 
{
diff --git a/ValueParsers/includes/parsers/DmCoordinateParser.php 
b/ValueParsers/includes/parsers/DmCoordinateParser.php
index 296af05..8039e36 100644
--- a/ValueParsers/includes/parsers/DmCoordinateParser.php
+++ b/ValueParsers/includes/parsers/DmCoordinateParser.php
@@ -38,33 +38,6 @@
        }
 
        /**
-        * @see GeoCoordinateParserBase::detectPrecision
-        */
-       protected function detectPrecision( $number ) {
-               $minutes = $number * 60;
-
-               // Since we are in the DM parser, we know that precision needs 
at least to be an arcminute:
-               $precision = 1 / 60;
-
-               // The minute may be a float; In order to detect a proper 
precision, we convert the minutes
-               // to seconds.
-               if( $minutes - floor( $minutes ) > 0 ) {
-                       $seconds = $minutes * 60;
-
-                       $precision = 1 / 3600;
-
-                       // TODO: Implement localized decimal separator.
-                       $secondsSplit = explode( '.', $seconds );
-
-                       if( isset( $secondsSplit[1] ) ) {
-                               $precision *= pow( 10, -1 * strlen( 
$secondsSplit[1] ) );
-                       }
-               }
-
-               return $precision;
-       }
-
-       /**
         * @see GeoCoordinateParserBase::areValidCoordinates
         */
        protected function areValidCoordinates( $normalizedCoordinateSegments ) 
{
diff --git a/ValueParsers/includes/parsers/DmsCoordinateParser.php 
b/ValueParsers/includes/parsers/DmsCoordinateParser.php
index 5f1fb59..9b19530 100644
--- a/ValueParsers/includes/parsers/DmsCoordinateParser.php
+++ b/ValueParsers/includes/parsers/DmsCoordinateParser.php
@@ -38,27 +38,6 @@
        }
 
        /**
-        * @see GeoCoordinateParserBase::detectPrecision
-        */
-       protected function detectPrecision( $number ) {
-               $seconds = $number * 3600;
-
-               // Since we are in the DMS parser, we know that precision needs 
at least to be an arcsecond:
-               $precision = 1 / 3600;
-
-               if( $number - floor( $number ) > 0 ) {
-                       // TODO: Implement localized decimal separator.
-                       $secondsSplit = explode( '.', $seconds );
-
-                       if( isset( $secondsSplit[1] ) ) {
-                               $precision *= pow( 10, -1 * strlen( 
$secondsSplit[1] ) );
-                       }
-               }
-
-               return $precision;
-       }
-
-       /**
         * @see GeoCoordinateParserBase::areValidCoordinates
         */
        protected function areValidCoordinates( $normalizedCoordinateSegments ) 
{
diff --git a/ValueParsers/includes/parsers/FloatCoordinateParser.php 
b/ValueParsers/includes/parsers/FloatCoordinateParser.php
index 4b0507b..49063d5 100644
--- a/ValueParsers/includes/parsers/FloatCoordinateParser.php
+++ b/ValueParsers/includes/parsers/FloatCoordinateParser.php
@@ -33,22 +33,6 @@
        }
 
        /**
-        * @see GeoCoordinateParserBase::detectPrecision
-        */
-       protected function detectPrecision( $number ) {
-               // TODO: Implement localized decimal separator.
-               $split = explode( '.', $number );
-
-               $precision = 1;
-
-               if( isset( $split[1] ) ) {
-                       $precision = pow( 10, -1 * strlen( $split[1] ) );
-               }
-
-               return $precision;
-       }
-
-       /**
         * @see GeoCoordinateParserBase::areValidCoordinates
         */
        protected function areValidCoordinates( $normalizedCoordinateSegments ) 
{
diff --git a/ValueParsers/includes/parsers/GeoCoordinateParser.php 
b/ValueParsers/includes/parsers/GeoCoordinateParser.php
index e94d4f2..10d559d 100644
--- a/ValueParsers/includes/parsers/GeoCoordinateParser.php
+++ b/ValueParsers/includes/parsers/GeoCoordinateParser.php
@@ -61,26 +61,6 @@
        const OPT_SEPARATOR_SYMBOL = 'separator';
 
        /**
-        * @since 0.1
-        *
-        * @param ParserOptions|null $options
-        */
-       public function __construct( ParserOptions $options = null ) {
-               parent::__construct( $options );
-
-               $this->defaultOption( self::OPT_NORTH_SYMBOL, 'N' );
-               $this->defaultOption( self::OPT_EAST_SYMBOL, 'E' );
-               $this->defaultOption( self::OPT_SOUTH_SYMBOL, 'S' );
-               $this->defaultOption( self::OPT_WEST_SYMBOL, 'W' );
-
-               $this->defaultOption( self::OPT_DEGREE_SYMBOL, '°' );
-               $this->defaultOption( self::OPT_MINUTE_SYMBOL, "'" );
-               $this->defaultOption( self::OPT_SECOND_SYMBOL, '"' );
-
-               $this->defaultOption( self::OPT_SEPARATOR_SYMBOL, ',' );
-       }
-
-       /**
         * @see StringValueParser::stringParse
         *
         * @since 0.1
@@ -118,7 +98,6 @@
 
                return $parsers;
        }
-
 
        /**
         * Convenience function for determining if something is a valid 
coordinate string.
diff --git a/ValueParsers/includes/parsers/GeoCoordinateParserBase.php 
b/ValueParsers/includes/parsers/GeoCoordinateParserBase.php
index 7f8423a..f8de34a 100644
--- a/ValueParsers/includes/parsers/GeoCoordinateParserBase.php
+++ b/ValueParsers/includes/parsers/GeoCoordinateParserBase.php
@@ -3,6 +3,7 @@
 namespace ValueParsers;
 
 use DataValues\GeoCoordinateValue;
+use DataValues\LatLongValue;
 
 /**
  * @since 0.1
@@ -67,17 +68,6 @@
        abstract protected function getParsedCoordinate( $coordinateSegment );
 
        /**
-        * Detects a number's precision.
-        *
-        * @since 0.1
-        *
-        * @param float $number
-        *
-        * @return int|float
-        */
-       abstract protected function detectPrecision( $number );
-
-       /**
         * Returns whether a coordinate split into its two segments is in the 
representation expected by
         * this parser.
         *
@@ -111,18 +101,9 @@
 
                list( $latitude, $longitude ) = $normalizedCoordinateSegments;
 
-               $latitude = $this->getParsedCoordinate( $latitude );
-               $longitude = $this->getParsedCoordinate( $longitude );
-
-               $precision = ( $this->options->hasOption( 'precision' ) )
-                       ? $this->options->getOption( 'precision' )
-                       : min( $this->detectPrecision( $latitude ), 
$this->detectPrecision( $longitude ) );
-
-               return new GeoCoordinateValue(
-                       $latitude,
-                       $longitude,
-                       null,
-                       $precision
+               return new LatLongValue(
+                       $this->getParsedCoordinate( $latitude ),
+                       $this->getParsedCoordinate( $longitude )
                );
        }
 
diff --git a/ValueParsers/includes/parsers/GlobeCoordinateParser.php 
b/ValueParsers/includes/parsers/GlobeCoordinateParser.php
new file mode 100644
index 0000000..3f4451b
--- /dev/null
+++ b/ValueParsers/includes/parsers/GlobeCoordinateParser.php
@@ -0,0 +1,149 @@
+<?php
+
+namespace ValueParsers;
+
+use DataValues\GeoCoordinateValue;
+use DataValues\LatLongValue;
+
+/**
+ * Extends the GeoCoordinateParser by adding precision detection support.
+ *
+ * The object that gets constructed is a GeoCoordinateValue rather then a 
LatLongValue.
+ *
+ * @since 0.1
+ *
+ * @file
+ * @ingroup ValueParsers
+ *
+ * @licence GNU GPL v2+
+ * @author Jeroen De Dauw < jeroended...@gmail.com >
+ * @author H. Snater < mediaw...@snater.com >
+ */
+class GlobeCoordinateParser extends StringValueParser {
+
+       /**
+        * @see StringValueParser::stringParse
+        *
+        * @since 0.1
+        *
+        * @param string $value
+        *
+        * @return GeoCoordinateValue
+        * @throws ParseException
+        */
+       protected function stringParse( $value ) {
+               foreach ( $this->getParsers() as $precisionDetector => $parser 
) {
+                       try {
+                               $latLong = $parser->parse( $value );
+
+                               return new GeoCoordinateValue(
+                                       $latLong->getLatitude(),
+                                       $latLong->getLongitude(),
+                                       null,
+                                       $this->detectPrecision( $latLong, 
$precisionDetector )
+                               );
+                       }
+                       catch ( ParseException $parseException ) {
+                               continue;
+                       }
+               }
+
+               throw new ParseException( 'The format of the coordinate could 
not be determined. Parsing failed.' );
+       }
+
+       protected function detectPrecision( LatLongValue $latLong, 
$precisionDetector ) {
+               if ( $this->options->hasOption( 'precision' ) ) {
+                       return $this->options->getOption( 'precision' );
+               }
+
+               return min(
+                       call_user_func( array( $this, $precisionDetector ), 
$latLong->getLatitude() ),
+                       call_user_func( array( $this, $precisionDetector ), 
$latLong->getLongitude() )
+               );
+       }
+
+       /**
+        * @return  StringValueParser[]
+        */
+       protected function getParsers() {
+               $parsers = array();
+
+               $parsers['detectFloatPrecision'] = new FloatCoordinateParser( 
$this->options );
+               $parsers['detectDmsPrecision'] = new DmsCoordinateParser( 
$this->options );
+               $parsers['detectDmPrecision'] = new DmCoordinateParser( 
$this->options );
+               $parsers['detectDdPrecision'] = new DdCoordinateParser( 
$this->options );
+
+               return $parsers;
+       }
+
+       protected function detectDdPrecision( $number ) {
+               // TODO: Implement localized decimal separator.
+               $split = explode( '.', $number );
+
+               $precision = 1;
+
+               if( isset( $split[1] ) ) {
+                       $precision = pow( 10, -1 * strlen( $split[1] ) );
+               }
+
+               return $precision;
+       }
+
+       protected function detectDmPrecision( $number ) {
+               $minutes = $number * 60;
+
+               // Since arcminutes shall be used to detect the precision, 
precision needs at least to be an
+               // arcminute:
+               $precision = 1 / 60;
+
+               // The minute may be a float; In order to detect a proper 
precision, we convert the minutes
+               // to seconds.
+               if( $minutes - floor( $minutes ) > 0 ) {
+                       $seconds = $minutes * 60;
+
+                       $precision = 1 / 3600;
+
+                       // TODO: Implement localized decimal separator.
+                       $secondsSplit = explode( '.', $seconds );
+
+                       if( isset( $secondsSplit[1] ) ) {
+                               $precision *= pow( 10, -1 * strlen( 
$secondsSplit[1] ) );
+                       }
+               }
+
+               return $precision;
+       }
+
+       protected function detectDmsPrecision( $number ) {
+               $seconds = $number * 3600;
+
+               // Since arcseconds shall be used to detect the precision, 
precision needs at least to be an
+               // arcsecond:
+               $precision = 1 / 3600;
+
+               if( $number - floor( $number ) > 0 ) {
+                       // TODO: Implement localized decimal separator.
+                       $secondsSplit = explode( '.', $seconds );
+
+                       if( isset( $secondsSplit[1] ) ) {
+                               $precision *= pow( 10, -1 * strlen( 
$secondsSplit[1] ) );
+                       }
+               }
+
+               return $precision;
+       }
+
+       protected function detectFloatPrecision( $number ) {
+               // TODO: Implement localized decimal separator.
+               $split = explode( '.', $number );
+
+               $precision = 1;
+
+               if( isset( $split[1] ) ) {
+                       $precision = pow( 10, -1 * strlen( $split[1] ) );
+               }
+
+               return $precision;
+       }
+
+}
diff --git a/ValueParsers/tests/phpunit/api/ApiParseValueTest.php 
b/ValueParsers/tests/phpunit/api/ApiParseValueTest.php
index 8b0aa34..d34a1ed 100644
--- a/ValueParsers/tests/phpunit/api/ApiParseValueTest.php
+++ b/ValueParsers/tests/phpunit/api/ApiParseValueTest.php
@@ -3,7 +3,7 @@
 namespace ValueParsers\Test;
 
 /**
- * Unit tests for the ValueParsers\ApiParseValue class.
+ * @covers ValueParsers\ApiParseValue
  *
  * @file
  * @since 0.1
@@ -21,7 +21,7 @@
  */
 class ApiParseValueTest extends \ApiTestCase {
 
-       public function testStuff() {
+       public function testApiRequest() {
                $params = array(
                        'action' => 'parsevalue',
                        'parser' => 'globecoordinate',
@@ -30,26 +30,34 @@
 
                list( $resultArray, ) = $this->doApiRequest( $params );
 
+               $this->assertIsResultArray( $resultArray );
+       }
+
+       protected function assertIsResultArray( $resultArray ) {
                $this->assertInternalType( 'array', $resultArray, 'top level 
element is an array' );
                $this->assertArrayHasKey( 'results', $resultArray, 'top level 
element has a results key' );
 
                foreach ( $resultArray['results'] as $result ) {
-                       $this->assertInternalType( 'array', $result, 'result is 
an array' );
-
-                       $this->assertArrayHasKey( 'value', $result, 'result has 
a value key' );
-                       $this->assertArrayHasKey( 'raw', $result, 'result has a 
raw key' );
-                       $this->assertArrayHasKey( 'type', $result, 'result has 
a type key' );
-
-                       $value = $result['value'];
-
-                       $this->assertInternalType( 'array', $value, 'value key 
points to an array' );
-
-                       $this->assertArrayHasKey( 'latitude', $value, 'value 
has latitude key' );
-                       $this->assertArrayHasKey( 'longitude', $value, 'value 
has longitude key' );
-                       $this->assertArrayHasKey( 'altitude', $value, 'value 
has altitude key' );
-                       $this->assertArrayHasKey( 'precision', $value, 'value 
has precision key' );
-                       $this->assertArrayHasKey( 'globe', $value, 'value has 
globe key' );
+                       $this->assertIsGeoValueArray( $result );
                }
        }
 
+       protected function assertIsGeoValueArray( $result ) {
+               $this->assertInternalType( 'array', $result, 'result is an 
array' );
+
+               $this->assertArrayHasKey( 'value', $result, 'result has a value 
key' );
+               $this->assertArrayHasKey( 'raw', $result, 'result has a raw 
key' );
+               $this->assertArrayHasKey( 'type', $result, 'result has a type 
key' );
+
+               $value = $result['value'];
+
+               $this->assertInternalType( 'array', $value, 'value key points 
to an array' );
+
+               $this->assertArrayHasKey( 'latitude', $value, 'value has 
latitude key' );
+               $this->assertArrayHasKey( 'longitude', $value, 'value has 
longitude key' );
+               $this->assertArrayHasKey( 'altitude', $value, 'value has 
altitude key' );
+               $this->assertArrayHasKey( 'precision', $value, 'value has 
precision key' );
+               $this->assertArrayHasKey( 'globe', $value, 'value has globe 
key' );
+       }
+
 }
diff --git a/ValueParsers/tests/phpunit/parsers/DdCoordinateParserTest.php 
b/ValueParsers/tests/phpunit/parsers/DdCoordinateParserTest.php
index a917b2a..2c3b624 100644
--- a/ValueParsers/tests/phpunit/parsers/DdCoordinateParserTest.php
+++ b/ValueParsers/tests/phpunit/parsers/DdCoordinateParserTest.php
@@ -3,10 +3,11 @@
 namespace ValueParsers\Test;
 
 use DataValues\GeoCoordinateValue;
+use DataValues\LatLongValue;
 use ValueParsers\DdCoordinateParser;
 
 /**
- * Unit tests for the ValueParsers\DdCoordinateParser class.
+ * @covers ValueParsers\DdCoordinateParser
  *
  * @file
  * @since 0.1
@@ -35,36 +36,30 @@
                // TODO: test with different parser options
 
                $valid = array(
-                       '55.7557860° N, 37.6176330° W' => array( 55.7557860, 
-37.6176330, 0.000001 ),
-                       '55.7557860°, -37.6176330°' => array( 55.7557860, 
-37.6176330, 0.000001 ),
+                       '55.7557860° N, 37.6176330° W' => array( 55.7557860, 
-37.6176330 ),
+                       '55.7557860°, -37.6176330°' => array( 55.7557860, 
-37.6176330 ),
                        '55° S, 37.6176330 ° W' => array( -55, -37.6176330, 
0.000001 ),
                        '-55°, -37.6176330 °' => array( -55, -37.6176330, 
0.000001 ),
                        '5.5°S,37°W ' => array( -5.5, -37, 0.1 ),
                        '-5.5°,-37° ' => array( -5.5, -37, 0.1 ),
 
                        // Coordinate strings without separator:
-                       '55.7557860° N 37.6176330° W' => array( 55.7557860, 
-37.6176330, 0.000001 ),
-                       '55.7557860° -37.6176330°' => array( 55.7557860, 
-37.6176330, 0.000001 ),
-                       '55° S 37.6176330 ° W' => array( -55, -37.6176330, 
0.000001 ),
-                       '-55° -37.6176330 °' => array( -55, -37.6176330, 
0.000001 ),
-                       '5.5°S 37°W ' => array( -5.5, -37, 0.1 ),
-                       '-5.5° -37° ' => array( -5.5, -37, 0.1 ),
+                       '55.7557860° N 37.6176330° W' => array( 55.7557860, 
-37.6176330 ),
+                       '55.7557860° -37.6176330°' => array( 55.7557860, 
-37.6176330 ),
+                       '55° S 37.6176330 ° W' => array( -55, -37.6176330 ),
+                       '-55° -37.6176330 °' => array( -55, -37.6176330 ),
+                       '5.5°S 37°W ' => array( -5.5, -37 ),
+                       '-5.5° -37° ' => array( -5.5, -37 ),
 
                        // Coordinate string starting with direction character:
-                       'N5.5° W37°' => array( 5.5, -37, 0.1 ),
-                       'S 5.5° E 37°' => array( -5.5, 37, 0.1 ),
+                       'N5.5° W37°' => array( 5.5, -37 ),
+                       'S 5.5° E 37°' => array( -5.5, 37 ),
                );
 
                foreach ( $valid as $value => $expected ) {
-                       $expected = new GeoCoordinateValue( $expected[0], 
$expected[1], null, $expected[2] );
+                       $expected = new LatLongValue( $expected[0], 
$expected[1] );
                        $argLists[] = array( (string)$value, $expected );
                }
-
-               // Checking whether precision gets set via the parser options:
-               $parser = $this->getInstance();
-               $parser->getOptions()->setOption( 'precision', 0.1 );
-               $expected = new GeoCoordinateValue( 1, 1, null, 0.1 );
-               $argLists[] = array( '1°, 1°', $expected, $parser );
 
                return $argLists;
        }
diff --git a/ValueParsers/tests/phpunit/parsers/DmCoordinateParserTest.php 
b/ValueParsers/tests/phpunit/parsers/DmCoordinateParserTest.php
index b4cbbfb..6c54017 100644
--- a/ValueParsers/tests/phpunit/parsers/DmCoordinateParserTest.php
+++ b/ValueParsers/tests/phpunit/parsers/DmCoordinateParserTest.php
@@ -3,10 +3,11 @@
 namespace ValueParsers\Test;
 
 use DataValues\GeoCoordinateValue;
+use DataValues\LatLongValue;
 use ValueParsers\DmCoordinateParser;
 
 /**
- * Unit tests for the ValueParsers\DmCoordinateParser class.
+ * @covers ValueParsers\DmCoordinateParser
  *
  * @file
  * @since 0.1
@@ -35,36 +36,30 @@
                // TODO: test with different parser options
 
                $valid = array(
-                       "55° 0', 37° 0'" => array( 55, 37, 1 / 60 ),
-                       "55° 30', 37° 30'" => array( 55.5, 37.5, 1 / 60 ),
-                       "0° 0', 0° 0'" => array( 0, 0, 1 / 60 ),
-                       "-55° 30', -37° 30'" => array( -55.5, -37.5, 1 / 60 ),
-                       "0° 0.3' S, 0° 0.3' W" => array( -0.005, -0.005, 1 / 
3600 ),
-                       "55° 30′, 37° 30′" => array( 55.5, 37.5, 1 / 60 ),
+                       "55° 0', 37° 0'" => array( 55, 37 ),
+                       "55° 30', 37° 30'" => array( 55.5, 37.5 ),
+                       "0° 0', 0° 0'" => array( 0, 0 ),
+                       "-55° 30', -37° 30'" => array( -55.5, -37.5 ),
+                       "0° 0.3' S, 0° 0.3' W" => array( -0.005, -0.005 ),
+                       "55° 30′, 37° 30′" => array( 55.5, 37.5 ),
 
                        // Coordinate strings without separator:
-                       "55° 0' 37° 0'" => array( 55, 37, 1 / 60 ),
-                       "55 ° 30 ' 37 ° 30 '" => array( 55.5, 37.5, 1 / 60 ),
-                       "0° 0' 0° 0'" => array( 0, 0, 1 / 60 ),
-                       "-55° 30 ' -37 ° 30'" => array( -55.5, -37.5, 1 / 60 ),
-                       "0° 0.3' S 0° 0.3' W" => array( -0.005, -0.005, 1 / 
3600 ),
-                       "55° 30′ 37° 30′" => array( 55.5, 37.5, 1 / 60 ),
+                       "55° 0' 37° 0'" => array( 55, 37 ),
+                       "55 ° 30 ' 37 ° 30 '" => array( 55.5, 37.5 ),
+                       "0° 0' 0° 0'" => array( 0, 0 ),
+                       "-55° 30 ' -37 ° 30'" => array( -55.5, -37.5 ),
+                       "0° 0.3' S 0° 0.3' W" => array( -0.005, -0.005 ),
+                       "55° 30′ 37° 30′" => array( 55.5, 37.5 ),
 
                        // Coordinate string starting with direction character:
-                       "S 0° 0.3', W 0° 0.3'" => array( -0.005, -0.005, 1 / 
3600 ),
-                       "N 0° 0.3' E 0° 0.3'" => array( 0.005, 0.005, 1 / 3600 
),
+                       "S 0° 0.3', W 0° 0.3'" => array( -0.005, -0.005 ),
+                       "N 0° 0.3' E 0° 0.3'" => array( 0.005, 0.005 ),
                );
 
                foreach ( $valid as $value => $expected ) {
-                       $expected = new GeoCoordinateValue( $expected[0], 
$expected[1], null, $expected[2] );
+                       $expected = new LatLongValue( $expected[0], 
$expected[1] );
                        $argLists[] = array( (string)$value, $expected );
                }
-
-               // Checking whether precision gets set via the parser options:
-               $parser = $this->getInstance();
-               $parser->getOptions()->setOption( 'precision', 0.1 );
-               $expected = new GeoCoordinateValue( 1.2, 1.2, null, 0.1 );
-               $argLists[] = array( '1° 12\', 1° 12\'', $expected, $parser );
 
                return $argLists;
        }
diff --git a/ValueParsers/tests/phpunit/parsers/DmsCoordinateParserTest.php 
b/ValueParsers/tests/phpunit/parsers/DmsCoordinateParserTest.php
index db6a842..57a88d8 100644
--- a/ValueParsers/tests/phpunit/parsers/DmsCoordinateParserTest.php
+++ b/ValueParsers/tests/phpunit/parsers/DmsCoordinateParserTest.php
@@ -3,10 +3,11 @@
 namespace ValueParsers\Test;
 
 use DataValues\GeoCoordinateValue;
+use DataValues\LatLongValue;
 use ValueParsers\DmsCoordinateParser;
 
 /**
- * Unit tests for the ValueParsers\DmsCoordinateParser class.
+ * @covers ValueParsers\DmsCoordinateParser
  *
  * @file
  * @since 0.1
@@ -35,39 +36,33 @@
                // TODO: test with different parser options
 
                $valid = array(
-                       '55° 45\' 20.8296", 37° 37\' 3.4788"' => array( 
55.755786, 37.617633, 1 / 3600 * 0.0001 ),
-                       '55° 45\' 20.8296", -37° 37\' 3.4788"' => array( 
55.755786, -37.617633, 1 / 3600 * 0.0001 ),
-                       '-55° 45\' 20.8296", -37° 37\' 3.4788"' => array( 
-55.755786, -37.617633, 1 / 3600 * 0.0001 ),
-                       '-55° 45\' 20.8296", 37° 37\' 3.4788"' => array( 
-55.755786, 37.617633, 1 / 3600 * 0.0001 ),
-                       '55° 0\' 0", 37° 0\' 0"' => array( 55, 37, 1 / 3600 ),
-                       '55° 30\' 0", 37° 30\' 0"' => array( 55.5, 37.5, 1 / 
3600 ),
-                       '55° 0\' 18", 37° 0\' 18"' => array( 55.005, 37.005, 1 
/ 3600 ),
-                       '0° 0\' 0", 0° 0\' 0"' => array( 0, 0, 1 / 3600 ),
-                       '0° 0\' 18" N, 0° 0\' 18" E' => array( 0.005, 0.005, 1 
/ 3600 ),
-                       ' 0° 0\' 18" S  , 0°  0\' 18"  W ' => array( -0.005, 
-0.005, 1 / 3600 ),
-                       '55° 0′ 18″, 37° 0′ 18″' => array( 55.005, 37.005, 1 / 
3600 ),
+                       '55° 45\' 20.8296", 37° 37\' 3.4788"' => array( 
55.755786, 37.617633 ),
+                       '55° 45\' 20.8296", -37° 37\' 3.4788"' => array( 
55.755786, -37.617633 ),
+                       '-55° 45\' 20.8296", -37° 37\' 3.4788"' => array( 
-55.755786, -37.617633 ),
+                       '-55° 45\' 20.8296", 37° 37\' 3.4788"' => array( 
-55.755786, 37.617633 ),
+                       '55° 0\' 0", 37° 0\' 0"' => array( 55, 37 ),
+                       '55° 30\' 0", 37° 30\' 0"' => array( 55.5, 37.5 ),
+                       '55° 0\' 18", 37° 0\' 18"' => array( 55.005, 37.005 ),
+                       '0° 0\' 0", 0° 0\' 0"' => array( 0, 0 ),
+                       '0° 0\' 18" N, 0° 0\' 18" E' => array( 0.005, 0.005 ),
+                       ' 0° 0\' 18" S  , 0°  0\' 18"  W ' => array( -0.005, 
-0.005 ),
+                       '55° 0′ 18″, 37° 0′ 18″' => array( 55.005, 37.005 ),
 
                        // Coordinate strings without separator:
-                       '55° 45\' 20.8296" 37° 37\' 3.4788"' => array( 
55.755786, 37.617633, 1 / 3600 * 0.0001 ),
-                       '55 ° 45 \' 20.8296 " -37 ° 37 \' 3.4788 "' => array( 
55.755786, -37.617633, 1 / 3600 * 0.0001 ),
-                       '-55 ° 45 \' 20.8296 " -37° 37\' 3.4788"' => array( 
-55.755786, -37.617633, 1 / 3600 * 0.0001 ),
-                       '55° 0′ 18″ 37° 0′ 18″' => array( 55.005, 37.005, 1 / 
3600 ),
+                       '55° 45\' 20.8296" 37° 37\' 3.4788"' => array( 
55.755786, 37.617633 ),
+                       '55 ° 45 \' 20.8296 " -37 ° 37 \' 3.4788 "' => array( 
55.755786, -37.617633 ),
+                       '-55 ° 45 \' 20.8296 " -37° 37\' 3.4788"' => array( 
-55.755786, -37.617633 ),
+                       '55° 0′ 18″ 37° 0′ 18″' => array( 55.005, 37.005 ),
 
                        // Coordinate string starting with direction character:
-                       'N 0° 0\' 18", E 0° 0\' 18"' => array( 0.005, 0.005, 1 
/ 3600 ),
-                       'S 0° 0\' 18" E 0° 0\' 18"' => array( -0.005, 0.005, 1 
/ 3600 ),
+                       'N 0° 0\' 18", E 0° 0\' 18"' => array( 0.005, 0.005 ),
+                       'S 0° 0\' 18" E 0° 0\' 18"' => array( -0.005, 0.005 ),
                );
 
                foreach ( $valid as $value => $expected ) {
-                       $expected = new GeoCoordinateValue( $expected[0], 
$expected[1], null, $expected[2] );
+                       $expected = new LatLongValue( $expected[0], 
$expected[1] );
                        $argLists[] = array( (string)$value, $expected );
                }
-
-               // Checking whether precision gets set via the parser options:
-               $parser = $this->getInstance();
-               $parser->getOptions()->setOption( 'precision', 0.1 );
-               $expected = new GeoCoordinateValue( 1.02, 1.02, null, 0.1 );
-               $argLists[] = array( '1° 1\' 12", 1° 1\' 12"', $expected, 
$parser );
 
                return $argLists;
        }
diff --git a/ValueParsers/tests/phpunit/parsers/FloatCoordinateParserTest.php 
b/ValueParsers/tests/phpunit/parsers/FloatCoordinateParserTest.php
index 8373622..0fd6937 100644
--- a/ValueParsers/tests/phpunit/parsers/FloatCoordinateParserTest.php
+++ b/ValueParsers/tests/phpunit/parsers/FloatCoordinateParserTest.php
@@ -3,6 +3,7 @@
 namespace ValueParsers\Test;
 
 use DataValues\GeoCoordinateValue;
+use DataValues\LatLongValue;
 use ValueParsers\FloatCoordinateParser;
 
 /**
@@ -35,38 +36,32 @@
                // TODO: test with different parser options
 
                $valid = array(
-                       '55.7557860 N, 37.6176330 W' => array( 55.7557860, 
-37.6176330, 0.000001 ),
-                       '55.7557860, -37.6176330' => array( 55.7557860, 
-37.6176330, 0.000001 ),
-                       '55 S, 37.6176330 W' => array( -55, -37.6176330, 
0.000001 ),
-                       '-55, -37.6176330' => array( -55, -37.6176330, 0.000001 
),
-                       '5.5S,37W ' => array( -5.5, -37, 0.1 ),
-                       '-5.5,-37 ' => array( -5.5, -37, 0.1 ),
-                       '4,2' => array( 4, 2, 1 ),
+                       '55.7557860 N, 37.6176330 W' => array( 55.7557860, 
-37.6176330 ),
+                       '55.7557860, -37.6176330' => array( 55.7557860, 
-37.6176330 ),
+                       '55 S, 37.6176330 W' => array( -55, -37.6176330 ),
+                       '-55, -37.6176330' => array( -55, -37.6176330 ),
+                       '5.5S,37W ' => array( -5.5, -37 ),
+                       '-5.5,-37 ' => array( -5.5, -37 ),
+                       '4,2' => array( 4, 2 ),
 
                        // Coordinate strings without separator:
-                       '55.7557860 N 37.6176330 W' => array( 55.7557860, 
-37.6176330, 0.000001 ),
-                       '55.7557860 -37.6176330' => array( 55.7557860, 
-37.6176330, 0.000001 ),
-                       '55 S 37.6176330 W' => array( -55, -37.6176330, 
0.000001 ),
-                       '-55 -37.6176330' => array( -55, -37.6176330, 0.000001 
),
-                       '5.5S 37W ' => array( -5.5, -37, 0.1 ),
-                       '-5.5 -37 ' => array( -5.5, -37, 0.1 ),
-                       '4 2' => array( 4, 2, 1 ),
+                       '55.7557860 N 37.6176330 W' => array( 55.7557860, 
-37.6176330 ),
+                       '55.7557860 -37.6176330' => array( 55.7557860, 
-37.6176330 ),
+                       '55 S 37.6176330 W' => array( -55, -37.6176330 ),
+                       '-55 -37.6176330' => array( -55, -37.6176330 ),
+                       '5.5S 37W ' => array( -5.5, -37 ),
+                       '-5.5 -37 ' => array( -5.5, -37 ),
+                       '4 2' => array( 4, 2 ),
 
                        // Coordinate string starting with direction character:
-                       'S5.5 W37 ' => array( -5.5, -37, 0.1 ),
-                       'N 5.5 E 37 ' => array( 5.5, 37, 0.1 ),
+                       'S5.5 W37 ' => array( -5.5, -37 ),
+                       'N 5.5 E 37 ' => array( 5.5, 37 ),
                );
 
                foreach ( $valid as $value => $expected ) {
-                       $expected = new GeoCoordinateValue( $expected[0], 
$expected[1], null, $expected[2] );
+                       $expected = new LatLongValue( $expected[0], 
$expected[1] );
                        $argLists[] = array( (string)$value, $expected );
                }
-
-               // Checking whether precision gets set via the parser options:
-               $parser = $this->getInstance();
-               $parser->getOptions()->setOption( 'precision', 0.1 );
-               $expected = new GeoCoordinateValue( 1, 1, null, 0.1 );
-               $argLists[] = array( '1, 1', $expected, $parser );
 
                return $argLists;
        }
diff --git a/ValueParsers/tests/phpunit/parsers/GeoCoordinateParserTest.php 
b/ValueParsers/tests/phpunit/parsers/GeoCoordinateParserTest.php
index 0ee6f7a..88131b2 100644
--- a/ValueParsers/tests/phpunit/parsers/GeoCoordinateParserTest.php
+++ b/ValueParsers/tests/phpunit/parsers/GeoCoordinateParserTest.php
@@ -3,10 +3,11 @@
 namespace ValueParsers\Test;
 
 use DataValues\GeoCoordinateValue;
+use DataValues\LatLongValue;
 use ValueParsers\GeoCoordinateParser;
 
 /**
- * Unit tests for the GeoCoordinateValue class.
+ * @covers ValueParsers\GeoCoordinateParser
  *
  * @file
  * @since 0.1
@@ -36,62 +37,62 @@
 
                $valid = array(
                        // Float
-                       '55.7557860 N, 37.6176330 W' => array( 55.7557860, 
-37.6176330, 0.000001 ),
-                       '55.7557860, -37.6176330' => array( 55.7557860, 
-37.6176330, 0.000001 ),
-                       '55 S, 37.6176330 W' => array( -55, -37.6176330, 
0.000001 ),
-                       '-55, -37.6176330' => array( -55, -37.6176330, 0.000001 
),
-                       '5.5S,37W ' => array( -5.5, -37, 0.1 ),
-                       '-5.5,-37 ' => array( -5.5, -37, 0.1 ),
+                       '55.7557860 N, 37.6176330 W' => array( 55.7557860, 
-37.6176330 ),
+                       '55.7557860, -37.6176330' => array( 55.7557860, 
-37.6176330 ),
+                       '55 S, 37.6176330 W' => array( -55, -37.6176330 ),
+                       '-55, -37.6176330' => array( -55, -37.6176330 ),
+                       '5.5S,37W ' => array( -5.5, -37 ),
+                       '-5.5,-37 ' => array( -5.5, -37 ),
                        '4,2' => array( 4, 2, 1 ),
-                       '5.5S 37W ' => array( -5.5, -37, 0.1 ),
-                       '-5.5 -37 ' => array( -5.5, -37, 0.1 ),
+                       '5.5S 37W ' => array( -5.5, -37 ),
+                       '-5.5 -37 ' => array( -5.5, -37 ),
                        '4 2' => array( 4, 2, 1 ),
-                       'S5.5 W37 ' => array( -5.5, -37, 0.1 ),
+                       'S5.5 W37 ' => array( -5.5, -37 ),
 
                        // DD
-                       '55.7557860° N, 37.6176330° W' => array( 55.7557860, 
-37.6176330, 0.000001 ),
-                       '55.7557860°, -37.6176330°' => array( 55.7557860, 
-37.6176330, 0.000001 ),
-                       '55° S, 37.6176330 ° W' => array( -55, -37.6176330, 
0.000001 ),
-                       '-55°, -37.6176330 °' => array( -55, -37.6176330, 
0.000001 ),
-                       '5.5°S,37°W ' => array( -5.5, -37, 0.1 ),
-                       '-5.5°,-37° ' => array( -5.5, -37, 0.1 ),
-                       '-55° -37.6176330 °' => array( -55, -37.6176330, 
0.000001 ),
-                       '5.5°S 37°W ' => array( -5.5, -37, 0.1 ),
-                       '-5.5 ° -37 ° ' => array( -5.5, -37, 0.1 ),
-                       'S5.5° W37°' => array( -5.5, -37, 0.1 ),
+                       '55.7557860° N, 37.6176330° W' => array( 55.7557860, 
-37.6176330 ),
+                       '55.7557860°, -37.6176330°' => array( 55.7557860, 
-37.6176330 ),
+                       '55° S, 37.6176330 ° W' => array( -55, -37.6176330 ),
+                       '-55°, -37.6176330 °' => array( -55, -37.6176330 ),
+                       '5.5°S,37°W ' => array( -5.5, -37 ),
+                       '-5.5°,-37° ' => array( -5.5, -37 ),
+                       '-55° -37.6176330 °' => array( -55, -37.6176330 ),
+                       '5.5°S 37°W ' => array( -5.5, -37 ),
+                       '-5.5 ° -37 ° ' => array( -5.5, -37 ),
+                       'S5.5° W37°' => array( -5.5, -37 ),
 
                        // DMS
-                       '55° 45\' 20.8296", 37° 37\' 3.4788"' => array( 
55.755786, 37.617633, 1 / 36000000 ),
-                       '55° 45\' 20.8296", -37° 37\' 3.4788"' => array( 
55.755786, -37.617633, 1 / 36000000 ),
-                       '-55° 45\' 20.8296", -37° 37\' 3.4788"' => array( 
-55.755786, -37.617633, 1 / 36000000 ),
-                       '-55° 45\' 20.8296", 37° 37\' 3.4788"' => array( 
-55.755786, 37.617633, 1 / 36000000 ),
-                       '55° 0\' 0", 37° 0\' 0"' => array( 55, 37, 1 / 3600 ),
-                       '55° 30\' 0", 37° 30\' 0"' => array( 55.5, 37.5, 1 / 
3600 ),
-                       '55° 0\' 18", 37° 0\' 18"' => array( 55.005, 37.005, 1 
/ 3600 ),
-                       '0° 0\' 0", 0° 0\' 0"' => array( 0, 0, 1 / 3600 ),
-                       '0° 0\' 18" N, 0° 0\' 18" E' => array( 0.005, 0.005, 1 
/ 3600 ),
-                       ' 0° 0\' 18" S  , 0°  0\' 18"  W ' => array( -0.005, 
-0.005, 1 / 3600 ),
-                       '0° 0′ 18″ N, 0° 0′ 18″ E' => array( 0.005, 0.005, 1 / 
3600 ),
-                       '0° 0\' 18" N  0° 0\' 18" E' => array( 0.005, 0.005, 1 
/ 3600 ),
-                       ' 0 ° 0 \' 18 " S   0 °  0 \' 18 "  W ' => array( 
-0.005, -0.005, 1 / 3600 ),
-                       '0° 0′ 18″ N 0° 0′ 18″ E' => array( 0.005, 0.005, 1 / 
3600 ),
-                       'N 0° 0\' 18" E 0° 0\' 18"' => array( 0.005, 0.005, 1 / 
3600 ),
+                       '55° 45\' 20.8296", 37° 37\' 3.4788"' => array( 
55.755786, 37.6176330000 ),
+                       '55° 45\' 20.8296", -37° 37\' 3.4788"' => array( 
55.755786, -37.6176330000 ),
+                       '-55° 45\' 20.8296", -37° 37\' 3.4788"' => array( 
-55.755786, -37.6176330000 ),
+                       '-55° 45\' 20.8296", 37° 37\' 3.4788"' => array( 
-55.755786, 37.6176330000 ),
+                       '55° 0\' 0", 37° 0\' 0"' => array( 55, 37 ),
+                       '55° 30\' 0", 37° 30\' 0"' => array( 55.5, 37.5 ),
+                       '55° 0\' 18", 37° 0\' 18"' => array( 55.005, 37.005 ),
+                       '0° 0\' 0", 0° 0\' 0"' => array( 0, 0 ),
+                       '0° 0\' 18" N, 0° 0\' 18" E' => array( 0.005, 0.005 ),
+                       ' 0° 0\' 18" S  , 0°  0\' 18"  W ' => array( -0.005, 
-0.005 ),
+                       '0° 0′ 18″ N, 0° 0′ 18″ E' => array( 0.005, 0.005 ),
+                       '0° 0\' 18" N  0° 0\' 18" E' => array( 0.005, 0.005 ),
+                       ' 0 ° 0 \' 18 " S   0 °  0 \' 18 "  W ' => array( 
-0.005, -0.005 ),
+                       '0° 0′ 18″ N 0° 0′ 18″ E' => array( 0.005, 0.005 ),
+                       'N 0° 0\' 18" E 0° 0\' 18"' => array( 0.005, 0.005 ),
 
                        // DM
-                       '55° 0\', 37° 0\'' => array( 55, 37, 1 / 60 ),
-                       '55° 30\', 37° 30\'' => array( 55.5, 37.5, 1 / 60 ),
-                       '0° 0\', 0° 0\'' => array( 0, 0, 1 / 60 ),
-                       '-55° 30\', -37° 30\'' => array( -55.5, -37.5, 1 / 60 ),
-                       '0° 0.3\' S, 0° 0.3\' W' => array( -0.005, -0.005, 1 / 
3600 ),
-                       '-55° 30′, -37° 30′' => array( -55.5, -37.5, 1 / 60 ),
-                       '-55 ° 30 \' -37 ° 30 \'' => array( -55.5, -37.5, 1 / 
60 ),
-                       '0° 0.3\' S 0° 0.3\' W' => array( -0.005, -0.005, 1 / 
3600 ),
-                       '-55° 30′ -37° 30′' => array( -55.5, -37.5, 1 / 60 ),
-                       'S 0° 0.3\' W 0° 0.3\'' => array( -0.005, -0.005, 1 / 
3600 ),
+                       '55° 0\', 37° 0\'' => array( 55, 37 ),
+                       '55° 30\', 37° 30\'' => array( 55.5, 37.5 ),
+                       '0° 0\', 0° 0\'' => array( 0, 0 ),
+                       '-55° 30\', -37° 30\'' => array( -55.5, -37.5 ),
+                       '0° 0.3\' S, 0° 0.3\' W' => array( -0.005, -0.005 ),
+                       '-55° 30′, -37° 30′' => array( -55.5, -37.5 ),
+                       '-55 ° 30 \' -37 ° 30 \'' => array( -55.5, -37.5 ),
+                       '0° 0.3\' S 0° 0.3\' W' => array( -0.005, -0.005 ),
+                       '-55° 30′ -37° 30′' => array( -55.5, -37.5 ),
+                       'S 0° 0.3\' W 0° 0.3\'' => array( -0.005, -0.005 ),
                );
 
                foreach ( $valid as $value => $expected ) {
-                       $expected = new GeoCoordinateValue( $expected[0], 
$expected[1], null, $expected[2] );
+                       $expected = new LatLongValue( $expected[0], 
$expected[1] );
                        $argLists[] = array( (string)$value, $expected );
                }
 
diff --git a/ValueParsers/tests/phpunit/parsers/GlobeCoordinateParserTest.php 
b/ValueParsers/tests/phpunit/parsers/GlobeCoordinateParserTest.php
new file mode 100644
index 0000000..e7a73fc
--- /dev/null
+++ b/ValueParsers/tests/phpunit/parsers/GlobeCoordinateParserTest.php
@@ -0,0 +1,125 @@
+<?php
+
+namespace ValueParsers\Test;
+
+use DataValues\GeoCoordinateValue;
+use ValueParsers\GeoCoordinateParser;
+
+/**
+ * @covers ValueParsers\GlobeCoordinateParser
+ *
+ * @file
+ * @since 0.1
+ *
+ * @ingroup ValueParsersTest
+ *
+ * @group ValueParsers
+ * @group DataValueExtensions
+ * @group GeoCoordinateParserTest
+ *
+ * @licence GNU GPL v2+
+ * @author Jeroen De Dauw < jeroended...@gmail.com >
+ */
+class GlobeCoordinateParserTest extends StringValueParserTest {
+
+       /**
+        * @see ValueParserTestBase::validInputProvider
+        *
+        * @since 0.1
+        *
+        * @return array
+        */
+       public function validInputProvider() {
+               $argLists = array();
+
+               $valid = array(
+                       // Float
+                       '55.7557860 N, 37.6176330 W' => array( 55.7557860, 
-37.6176330, 0.000001 ),
+                       '55.7557860, -37.6176330' => array( 55.7557860, 
-37.6176330, 0.000001 ),
+                       '55 S, 37.6176330 W' => array( -55, -37.6176330, 
0.000001 ),
+                       '-55, -37.6176330' => array( -55, -37.6176330, 0.000001 
),
+                       '5.5S,37W ' => array( -5.5, -37, 0.1 ),
+                       '-5.5,-37 ' => array( -5.5, -37, 0.1 ),
+                       '4,2' => array( 4, 2, 1 ),
+                       '5.5S 37W ' => array( -5.5, -37, 0.1 ),
+                       '-5.5 -37 ' => array( -5.5, -37, 0.1 ),
+                       '4 2' => array( 4, 2, 1 ),
+                       'S5.5 W37 ' => array( -5.5, -37, 0.1 ),
+
+                       // DD
+                       '55.7557860° N, 37.6176330° W' => array( 55.7557860, 
-37.6176330, 0.000001 ),
+                       '55.7557860°, -37.6176330°' => array( 55.7557860, 
-37.6176330, 0.000001 ),
+                       '55° S, 37.6176330 ° W' => array( -55, -37.6176330, 
0.000001 ),
+                       '-55°, -37.6176330 °' => array( -55, -37.6176330, 
0.000001 ),
+                       '5.5°S,37°W ' => array( -5.5, -37, 0.1 ),
+                       '-5.5°,-37° ' => array( -5.5, -37, 0.1 ),
+                       '-55° -37.6176330 °' => array( -55, -37.6176330, 
0.000001 ),
+                       '5.5°S 37°W ' => array( -5.5, -37, 0.1 ),
+                       '-5.5 ° -37 ° ' => array( -5.5, -37, 0.1 ),
+                       'S5.5° W37°' => array( -5.5, -37, 0.1 ),
+
+                       // DMS
+                       '55° 45\' 20.8296", 37° 37\' 3.4788"' => array( 
55.755786, 37.617633, 1 / 36000000 ),
+                       '55° 45\' 20.8296", -37° 37\' 3.4788"' => array( 
55.755786, -37.617633, 1 / 36000000 ),
+                       '-55° 45\' 20.8296", -37° 37\' 3.4788"' => array( 
-55.755786, -37.617633, 1 / 36000000 ),
+                       '-55° 45\' 20.8296", 37° 37\' 3.4788"' => array( 
-55.755786, 37.617633, 1 / 36000000 ),
+                       '55° 0\' 0", 37° 0\' 0"' => array( 55, 37, 1 / 3600 ),
+                       '55° 30\' 0", 37° 30\' 0"' => array( 55.5, 37.5, 1 / 
3600 ),
+                       '55° 0\' 18", 37° 0\' 18"' => array( 55.005, 37.005, 1 
/ 3600 ),
+                       '0° 0\' 0", 0° 0\' 0"' => array( 0, 0, 1 / 3600 ),
+                       '0° 0\' 18" N, 0° 0\' 18" E' => array( 0.005, 0.005, 1 
/ 3600 ),
+                       ' 0° 0\' 18" S  , 0°  0\' 18"  W ' => array( -0.005, 
-0.005, 1 / 3600 ),
+                       '0° 0′ 18″ N, 0° 0′ 18″ E' => array( 0.005, 0.005, 1 / 
3600 ),
+                       '0° 0\' 18" N  0° 0\' 18" E' => array( 0.005, 0.005, 1 
/ 3600 ),
+                       ' 0 ° 0 \' 18 " S   0 °  0 \' 18 "  W ' => array( 
-0.005, -0.005, 1 / 3600 ),
+                       '0° 0′ 18″ N 0° 0′ 18″ E' => array( 0.005, 0.005, 1 / 
3600 ),
+                       'N 0° 0\' 18" E 0° 0\' 18"' => array( 0.005, 0.005, 1 / 
3600 ),
+
+                       // DM
+                       '55° 0\', 37° 0\'' => array( 55, 37, 1 / 60 ),
+                       '55° 30\', 37° 30\'' => array( 55.5, 37.5, 1 / 60 ),
+                       '0° 0\', 0° 0\'' => array( 0, 0, 1 / 60 ),
+                       '-55° 30\', -37° 30\'' => array( -55.5, -37.5, 1 / 60 ),
+                       '0° 0.3\' S, 0° 0.3\' W' => array( -0.005, -0.005, 1 / 
3600 ),
+                       '-55° 30′, -37° 30′' => array( -55.5, -37.5, 1 / 60 ),
+                       '-55 ° 30 \' -37 ° 30 \'' => array( -55.5, -37.5, 1 / 
60 ),
+                       '0° 0.3\' S 0° 0.3\' W' => array( -0.005, -0.005, 1 / 
3600 ),
+                       '-55° 30′ -37° 30′' => array( -55.5, -37.5, 1 / 60 ),
+                       'S 0° 0.3\' W 0° 0.3\'' => array( -0.005, -0.005, 1 / 
3600 ),
+               );
+
+               foreach ( $valid as $value => $expected ) {
+                       $expected = new GeoCoordinateValue( $expected[0], 
$expected[1], null, $expected[2] );
+                       $argLists[] = array( (string)$value, $expected );
+               }
+
+               return $argLists;
+       }
+
+       public function invalidInputProvider() {
+               $argLists = parent::invalidInputProvider();
+
+               $invalid = array(
+                       '~=[,,_,,]:3',
+                       'ohi there',
+               );
+
+               foreach ( $invalid as $value ) {
+                       $argLists[] = array( $value );
+               }
+
+               return $argLists;
+       }
+
+       /**
+        * @see ValueParserTestBase::getParserClass
+        *
+        * @since 0.1
+        *
+        * @return string
+        */
+       protected function getParserClass() {
+               return 'ValueParsers\GlobeCoordinateParser';
+       }
+
+}

-- 
To view, visit https://gerrit.wikimedia.org/r/79985
To unsubscribe, visit https://gerrit.wikimedia.org/r/settings

Gerrit-MessageType: merged
Gerrit-Change-Id: I20012795ced95e8afda7f2c21fd32730dc408432
Gerrit-PatchSet: 3
Gerrit-Project: mediawiki/extensions/DataValues
Gerrit-Branch: master
Gerrit-Owner: Jeroen De Dauw <jeroended...@gmail.com>
Gerrit-Reviewer: Daniel Werner <daniel.wer...@wikimedia.de>
Gerrit-Reviewer: Henning Snater <henning.sna...@wikimedia.de>
Gerrit-Reviewer: jenkins-bot

_______________________________________________
MediaWiki-commits mailing list
MediaWiki-commits@lists.wikimedia.org
https://lists.wikimedia.org/mailman/listinfo/mediawiki-commits

Reply via email to