Aude has uploaded a new change for review.

  https://gerrit.wikimedia.org/r/176998

Change subject: Update data values geo for Wikidata
......................................................................

Update data values geo for Wikidata

the latest version somehow didn't get pulled in and
the division by zero warnings are back.

Change-Id: If1d2b573d0188152bca59e7bc04d181691548c1b
---
M composer.lock
M vendor/composer/autoload_files.php
M vendor/composer/installed.json
M vendor/data-values/geo/Geo.php
M vendor/data-values/geo/README.md
M vendor/data-values/geo/src/Formatters/GeoCoordinateFormatter.php
M vendor/data-values/geo/tests/unit/Formatters/GeoCoordinateFormatterTest.php
M vendor/data-values/geo/tests/unit/Formatters/GlobeCoordinateFormatterTest.php
8 files changed, 103 insertions(+), 79 deletions(-)


  git pull ssh://gerrit.wikimedia.org:29418/mediawiki/extensions/Wikidata 
refs/changes/98/176998/1

diff --git a/composer.lock b/composer.lock
index 7eea7ff..3f2eb5d 100644
--- a/composer.lock
+++ b/composer.lock
@@ -264,16 +264,16 @@
         },
         {
             "name": "data-values/geo",
-            "version": "1.1.3",
+            "version": "1.1.4",
             "source": {
                 "type": "git",
                 "url": "https://github.com/DataValues/Geo.git";,
-                "reference": "ed6d1e54302e7e455b27d4e54d2bfb1e3cfe8645"
+                "reference": "e7222bc743ae05bfc5213cb1e20150aa772d8668"
             },
             "dist": {
                 "type": "zip",
-                "url": 
"https://api.github.com/repos/DataValues/Geo/zipball/ed6d1e54302e7e455b27d4e54d2bfb1e3cfe8645";,
-                "reference": "ed6d1e54302e7e455b27d4e54d2bfb1e3cfe8645",
+                "url": 
"https://api.github.com/repos/DataValues/Geo/zipball/e7222bc743ae05bfc5213cb1e20150aa772d8668";,
+                "reference": "e7222bc743ae05bfc5213cb1e20150aa772d8668",
                 "shasum": ""
             },
             "require": {
@@ -323,7 +323,7 @@
                 "parsers",
                 "wikidata"
             ],
-            "time": "2014-11-19 17:53:17"
+            "time": "2014-11-25 16:48:57"
         },
         {
             "name": "data-values/interfaces",
diff --git a/vendor/composer/autoload_files.php 
b/vendor/composer/autoload_files.php
index c507edd..519f050 100644
--- a/vendor/composer/autoload_files.php
+++ b/vendor/composer/autoload_files.php
@@ -14,8 +14,8 @@
     $vendorDir . '/data-values/javascript/DataValuesJavascript.php',
     $vendorDir . '/data-values/time/Time.php',
     $vendorDir . '/data-values/number/Number.php',
-    $vendorDir . '/data-values/geo/Geo.php',
     $vendorDir . '/wikibase/data-model/WikibaseDataModel.php',
+    $vendorDir . '/data-values/geo/Geo.php',
     $vendorDir . '/wikibase/data-model-javascript/init.php',
     $vendorDir . '/wikibase/serialization-javascript/init.php',
     $baseDir . '/extensions/ValueView/ValueView.php',
diff --git a/vendor/composer/installed.json b/vendor/composer/installed.json
index 8608e5d..0c9d121 100644
--- a/vendor/composer/installed.json
+++ b/vendor/composer/installed.json
@@ -1052,71 +1052,6 @@
         ]
     },
     {
-        "name": "data-values/geo",
-        "version": "1.1.3",
-        "version_normalized": "1.1.3.0",
-        "source": {
-            "type": "git",
-            "url": "https://github.com/DataValues/Geo.git";,
-            "reference": "ed6d1e54302e7e455b27d4e54d2bfb1e3cfe8645"
-        },
-        "dist": {
-            "type": "zip",
-            "url": 
"https://api.github.com/repos/DataValues/Geo/zipball/ed6d1e54302e7e455b27d4e54d2bfb1e3cfe8645";,
-            "reference": "ed6d1e54302e7e455b27d4e54d2bfb1e3cfe8645",
-            "shasum": ""
-        },
-        "require": {
-            "data-values/common": "~0.1",
-            "data-values/data-values": "~1.0|~0.1",
-            "data-values/interfaces": "~0.1",
-            "php": ">=5.3.0"
-        },
-        "time": "2014-11-19 17:53:17",
-        "type": "library",
-        "extra": {
-            "branch-alias": {
-                "dev-master": "1.1.x-dev"
-            }
-        },
-        "installation-source": "dist",
-        "autoload": {
-            "files": [
-                "Geo.php"
-            ],
-            "psr-4": {
-                "DataValues\\Geo\\": "src"
-            }
-        },
-        "notification-url": "https://packagist.org/downloads/";,
-        "license": [
-            "GPL-2.0+"
-        ],
-        "authors": [
-            {
-                "name": "Jeroen De Dauw",
-                "email": "[email protected]",
-                "homepage": "http://jeroendedauw.com";,
-                "role": "Developer"
-            },
-            {
-                "name": "The Wikidata team",
-                "role": "Developer"
-            }
-        ],
-        "description": "Geographical value objects, parsers and formatters",
-        "homepage": "https://github.com/DataValues/Geo";,
-        "keywords": [
-            "datavalues",
-            "formatters",
-            "geo",
-            "geographical",
-            "latlong",
-            "parsers",
-            "wikidata"
-        ]
-    },
-    {
         "name": "wikibase/wikimedia-badges",
         "version": "dev-master",
         "version_normalized": "9999999-dev",
@@ -1353,5 +1288,70 @@
             "wikibaserepo",
             "wikidata"
         ]
+    },
+    {
+        "name": "data-values/geo",
+        "version": "1.1.4",
+        "version_normalized": "1.1.4.0",
+        "source": {
+            "type": "git",
+            "url": "https://github.com/DataValues/Geo.git";,
+            "reference": "e7222bc743ae05bfc5213cb1e20150aa772d8668"
+        },
+        "dist": {
+            "type": "zip",
+            "url": 
"https://api.github.com/repos/DataValues/Geo/zipball/e7222bc743ae05bfc5213cb1e20150aa772d8668";,
+            "reference": "e7222bc743ae05bfc5213cb1e20150aa772d8668",
+            "shasum": ""
+        },
+        "require": {
+            "data-values/common": "~0.1",
+            "data-values/data-values": "~1.0|~0.1",
+            "data-values/interfaces": "~0.1",
+            "php": ">=5.3.0"
+        },
+        "time": "2014-11-25 16:48:57",
+        "type": "library",
+        "extra": {
+            "branch-alias": {
+                "dev-master": "1.1.x-dev"
+            }
+        },
+        "installation-source": "dist",
+        "autoload": {
+            "files": [
+                "Geo.php"
+            ],
+            "psr-4": {
+                "DataValues\\Geo\\": "src"
+            }
+        },
+        "notification-url": "https://packagist.org/downloads/";,
+        "license": [
+            "GPL-2.0+"
+        ],
+        "authors": [
+            {
+                "name": "Jeroen De Dauw",
+                "email": "[email protected]",
+                "homepage": "http://jeroendedauw.com";,
+                "role": "Developer"
+            },
+            {
+                "name": "The Wikidata team",
+                "role": "Developer"
+            }
+        ],
+        "description": "Geographical value objects, parsers and formatters",
+        "homepage": "https://github.com/DataValues/Geo";,
+        "keywords": [
+            "datavalues",
+            "formatters",
+            "geo",
+            "geographical",
+            "latlong",
+            "parsers",
+            "wikidata"
+        ]
     }
 ]
diff --git a/vendor/data-values/geo/Geo.php b/vendor/data-values/geo/Geo.php
index 57eee59..84f3d63 100644
--- a/vendor/data-values/geo/Geo.php
+++ b/vendor/data-values/geo/Geo.php
@@ -15,7 +15,7 @@
        return 1;
 }
 
-define( 'DATAVALUES_GEO_VERSION', '1.1.3' );
+define( 'DATAVALUES_GEO_VERSION', '1.1.4' );
 
 if ( defined( 'MEDIAWIKI' ) ) {
        $GLOBALS['wgExtensionCredits']['datavalues'][] = array(
diff --git a/vendor/data-values/geo/README.md b/vendor/data-values/geo/README.md
index d799dc7..a89be83 100644
--- a/vendor/data-values/geo/README.md
+++ b/vendor/data-values/geo/README.md
@@ -93,9 +93,13 @@
 
 ## Release notes
 
+### 1.1.4 (2014-11-25)
+
+* Add fall back to default on invalid precision to more places.
+
 ### 1.1.3 (2014-11-19)
 
-* On invalid precision fall back to default instead of dividing by zero.
+* Fall back to default on invalid precision instead of dividing by zero.
 
 ### 1.1.2 (2014-11-18)
 
diff --git a/vendor/data-values/geo/src/Formatters/GeoCoordinateFormatter.php 
b/vendor/data-values/geo/src/Formatters/GeoCoordinateFormatter.php
index 2306a4e..0ee4909 100644
--- a/vendor/data-values/geo/src/Formatters/GeoCoordinateFormatter.php
+++ b/vendor/data-values/geo/src/Formatters/GeoCoordinateFormatter.php
@@ -113,10 +113,6 @@
 
                $precision = $this->options->getOption( self::OPT_PRECISION );
 
-               if ( $precision <= 0 ) {
-                       $precision = 1 / 3600;
-               }
-
                return $this->formatLatLongValue( $value, $precision );
        }
 
@@ -132,6 +128,10 @@
         * @throws InvalidArgumentException
         */
        public function formatLatLongValue( LatLongValue $value, $precision ) {
+               if ( $precision <= 0 ) {
+                       $precision = 1 / 3600;
+               }
+
                $formatted = implode(
                        $this->getOption( self::OPT_SEPARATOR_SYMBOL ) . 
$this->getSpacing( self::OPT_SPACE_LATLONG ),
                        array(
diff --git 
a/vendor/data-values/geo/tests/unit/Formatters/GeoCoordinateFormatterTest.php 
b/vendor/data-values/geo/tests/unit/Formatters/GeoCoordinateFormatterTest.php
index 4cc8676..ac988f9 100644
--- 
a/vendor/data-values/geo/tests/unit/Formatters/GeoCoordinateFormatterTest.php
+++ 
b/vendor/data-values/geo/tests/unit/Formatters/GeoCoordinateFormatterTest.php
@@ -488,7 +488,7 @@
        /**
         * @dataProvider invalidPrecisionProvider
         */
-       public function testInvalidPrecision_fallsBackToDefaultPrecision( 
$precision ) {
+       public function 
testFormatWithInvalidPrecision_fallsBackToDefaultPrecision( $precision ) {
                $options = new FormatterOptions();
                $options->setOption( GeoCoordinateFormatter::OPT_PRECISION, 
$precision );
                $formatter = new GeoCoordinateFormatter( $options );
@@ -497,6 +497,16 @@
                $this->assertEquals( '1.2, 3.4', $formatted );
        }
 
+       /**
+        * @dataProvider invalidPrecisionProvider
+        */
+       public function 
testFormatLatLongValueWithInvalidPrecision_fallsBackToDefaultPrecision( 
$precision ) {
+               $formatter = new GeoCoordinateFormatter( new FormatterOptions() 
);
+
+               $formatted = $formatter->formatLatLongValue( new LatLongValue( 
1.2, 3.4 ), $precision );
+               $this->assertEquals( '1.2, 3.4', $formatted );
+       }
+
        public function invalidPrecisionProvider() {
                return array(
                        array( null ),
diff --git 
a/vendor/data-values/geo/tests/unit/Formatters/GlobeCoordinateFormatterTest.php 
b/vendor/data-values/geo/tests/unit/Formatters/GlobeCoordinateFormatterTest.php
index 4d617a5..0b54c65 100644
--- 
a/vendor/data-values/geo/tests/unit/Formatters/GlobeCoordinateFormatterTest.php
+++ 
b/vendor/data-values/geo/tests/unit/Formatters/GlobeCoordinateFormatterTest.php
@@ -3,6 +3,7 @@
 namespace Tests\DataValues\Geo\Formatters;
 
 use DataValues\Geo\Formatters\GeoCoordinateFormatter;
+use DataValues\Geo\Formatters\GlobeCoordinateFormatter;
 use DataValues\Geo\Parsers\GlobeCoordinateParser;
 use DataValues\Geo\Values\GlobeCoordinateValue;
 use DataValues\Geo\Values\LatLongValue;
@@ -108,8 +109,17 @@
                return 'DataValues\Geo\Formatters\GlobeCoordinateFormatter';
        }
 
+       public function 
testFormatWithInvalidPrecision_fallsBackToDefaultPrecision() {
+               $options = new FormatterOptions();
+               $options->setOption( GeoCoordinateFormatter::OPT_PRECISION, 0 );
+               $formatter = new GlobeCoordinateFormatter( $options );
+
+               $formatted = $formatter->format( new GlobeCoordinateValue( new 
LatLongValue( 1.2, 3.4 ), null ) );
+               $this->assertEquals( '1.2, 3.4', $formatted );
+       }
+
        /**
-        * @dataProvider validProvider()
+        * @dataProvider validProvider
         */
        public function testFormatterRoundTrip( GlobeCoordinateValue $coord, 
$expectedValue, FormatterOptions $options )  {
                $formatter = $this->getInstance( $options );

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

Gerrit-MessageType: newchange
Gerrit-Change-Id: If1d2b573d0188152bca59e7bc04d181691548c1b
Gerrit-PatchSet: 1
Gerrit-Project: mediawiki/extensions/Wikidata
Gerrit-Branch: wmf/1.25wmf10
Gerrit-Owner: Aude <[email protected]>

_______________________________________________
MediaWiki-commits mailing list
[email protected]
https://lists.wikimedia.org/mailman/listinfo/mediawiki-commits

Reply via email to