File tree 2 files changed +5
-3
lines changed
tests/Geocoder/Tests/Provider 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)
100
100
$ content = (string ) $ this ->getAdapter ()->get ($ query )->getBody ();
101
101
$ json = (array ) json_decode ($ content , true );
102
102
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
+ ) {
104
106
throw new NoResult (sprintf ('Could not execute query "%s". ' , $ query ));
105
107
}
106
108
Original file line number Diff line number Diff line change @@ -42,7 +42,7 @@ public function testGeocodeWithLocalhostIPv6()
42
42
*/
43
43
public function testGeocodeWithNull ()
44
44
{
45
- $ provider = new Yandex ($ this ->getMockAdapter ( ));
45
+ $ provider = new Yandex ($ this ->getMockAdapterReturns ( ' {"error":{"status":"400","message":"missing geocode parameter"}} ' ));
46
46
$ provider ->geocode (null );
47
47
}
48
48
@@ -52,7 +52,7 @@ public function testGeocodeWithNull()
52
52
*/
53
53
public function testGeocodeWithEmpty ()
54
54
{
55
- $ provider = new Yandex ($ this ->getMockAdapter ( ));
55
+ $ provider = new Yandex ($ this ->getMockAdapterReturns ( ' {"error":{"status":"400","message":"missing geocode parameter"}} ' ));
56
56
$ provider ->geocode ('' );
57
57
}
58
58
You can’t perform that action at this time.
0 commit comments