File tree Expand file tree Collapse file tree 2 files changed +20
-6
lines changed
tests/Geocoder/Tests/Provider Expand file tree Collapse file tree 2 files changed +20
-6
lines changed Original file line number Diff line number Diff line change @@ -73,12 +73,17 @@ protected function executeQuery($query)
7373 ->children ('' , true )
7474 ->Hostip ;
7575
76- $ lngLat = explode (', ' , (string ) $ dataNode
77- ->ipLocation
78- ->children ('gml ' , true )
79- ->pointProperty
80- ->Point
81- ->coordinates );
76+ if (isset ($ dataNode ->ipLocation )) {
77+ $ lngLat = explode (', ' , (string ) $ dataNode
78+ ->ipLocation
79+ ->children ('gml ' , true )
80+ ->pointProperty
81+ ->Point
82+ ->coordinates
83+ );
84+ } else {
85+ $ lngLat = array (null , null );
86+ }
8287
8388 $ city = (string ) $ dataNode
8489 ->children ('gml ' , true )
Original file line number Diff line number Diff line change @@ -94,4 +94,13 @@ public function testGetReverseData()
9494 $ this ->provider = new HostIpProvider ($ this ->getMockAdapter ($ this ->never ()));
9595 $ this ->provider ->getReversedData (array (1 , 2 ));
9696 }
97+
98+ public function testGetGeocodedDataWithAnotherIp ()
99+ {
100+ $ this ->provider = new HostIpProvider (new \Geocoder \HttpAdapter \BuzzHttpAdapter ());
101+ $ result = $ this ->provider ->getGeocodedData ('33.33.33.22 ' );
102+
103+ $ this ->assertNull ($ result ['latitude ' ]);
104+ $ this ->assertNull ($ result ['longitude ' ]);
105+ }
97106}
You can’t perform that action at this time.
0 commit comments