File tree Expand file tree Collapse file tree 2 files changed +5
-3
lines changed
tests/Geocoder/Tests/Provider Expand file tree Collapse file tree 2 files changed +5
-3
lines changed Original file line number Diff line number Diff line change @@ -100,7 +100,9 @@ private function executeQuery($query)
100100 $ content = (string ) $ this ->getAdapter ()->get ($ query )->getBody ();
101101 $ json = (array ) json_decode ($ content , true );
102102
103- if (empty ($ json ) || '0 ' === $ json ['response ' ]['GeoObjectCollection ' ]['metaDataProperty ' ]['GeocoderResponseMetaData ' ]['found ' ]) {
103+ if (empty ($ json ) || isset ($ json ['error ' ]) ||
104+ (isset ($ json ['response ' ]) && '0 ' === $ json ['response ' ]['GeoObjectCollection ' ]['metaDataProperty ' ]['GeocoderResponseMetaData ' ]['found ' ])
105+ ) {
104106 throw new NoResult (sprintf ('Could not execute query "%s". ' , $ query ));
105107 }
106108
Original file line number Diff line number Diff line change @@ -42,7 +42,7 @@ public function testGeocodeWithLocalhostIPv6()
4242 */
4343 public function testGeocodeWithNull ()
4444 {
45- $ provider = new Yandex ($ this ->getMockAdapter ( ));
45+ $ provider = new Yandex ($ this ->getMockAdapterReturns ( ' {"error":{"status":"400","message":"missing geocode parameter"}} ' ));
4646 $ provider ->geocode (null );
4747 }
4848
@@ -52,7 +52,7 @@ public function testGeocodeWithNull()
5252 */
5353 public function testGeocodeWithEmpty ()
5454 {
55- $ provider = new Yandex ($ this ->getMockAdapter ( ));
55+ $ provider = new Yandex ($ this ->getMockAdapterReturns ( ' {"error":{"status":"400","message":"missing geocode parameter"}} ' ));
5656 $ provider ->geocode ('' );
5757 }
5858
You can’t perform that action at this time.
0 commit comments