|
16 | 16 | use Geocoder\Model\Bounds; |
17 | 17 | use Geocoder\Model\Coordinates; |
18 | 18 | use Geocoder\Model\Country; |
19 | | -use Geocoder\Model\Query\GeocodeQuery; |
20 | | -use Geocoder\Model\Query\ReverseQuery; |
21 | 19 | use Geocoder\Provider\Provider; |
| 20 | +use Geocoder\Query\GeocodeQuery; |
| 21 | +use Geocoder\Query\ReverseQuery; |
22 | 22 | use GuzzleHttp\Psr7\Response; |
23 | 23 | use Http\Client\HttpClient; |
24 | 24 | use Http\Discovery\HttpClientDiscovery; |
@@ -97,6 +97,19 @@ public function testGeocodeQuery() |
97 | 97 | $this->assertContains('10', $location->getStreetNumber(), 'Street number should contain "10"'); |
98 | 98 | } |
99 | 99 |
|
| 100 | + public function testGeocodeQueryWithNoResults() |
| 101 | + { |
| 102 | + if (isset($this->skippedTests[__FUNCTION__])) { |
| 103 | + $this->markTestSkipped($this->skippedTests[__FUNCTION__]); |
| 104 | + } |
| 105 | + |
| 106 | + $provider = $this->createProvider($this->getCachedHttpClient()); |
| 107 | + $query = GeocodeQuery::create('jsajhgsdkfjhsfkjhaldkadjaslgldasd')->withLocale('en'); |
| 108 | + $result = $provider->geocodeQuery($query); |
| 109 | + $this->assertWellFormattedResult($result); |
| 110 | + $this->assertEquals(0, $result->count()); |
| 111 | + } |
| 112 | + |
100 | 113 | public function testReverseQuery() |
101 | 114 | { |
102 | 115 | if (isset($this->skippedTests[__FUNCTION__])) { |
@@ -292,8 +305,6 @@ private function assertWellFormattedResult(Collection $result) |
292 | 305 | 'The result must be an instance of a Geocoder\Collection' |
293 | 306 | ); |
294 | 307 |
|
295 | | - $this->assertNotEmpty($result, 'Geocoder\Exception should never be empty. A NoResult exception should be thrown.'); |
296 | | - |
297 | 308 | /** @var Location $location */ |
298 | 309 | foreach ($result as $location) { |
299 | 310 | $this->assertInstanceOf( |
|
0 commit comments