Skip to content

Commit a328949

Browse files
committed
Add unit test to catch failed geocoding
1 parent 9f9df7f commit a328949

File tree

1 file changed

+15
-0
lines changed

1 file changed

+15
-0
lines changed

tests/Laravel5_3/Providers/GeocoderServiceTest.php

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -194,4 +194,19 @@ public function testJapaneseCharacterGeocoding()
194194
$this->assertEquals($cacheKey, '108-0075e69db1e4baace983bde6b8afe58cbae6b8afe58d97efbc92e4b881e79baeefbc91efbc96efbc8defbc93');
195195
$this->assertTrue(cache()->has("geocoder-{$cacheKey}"));
196196
}
197+
198+
public function testFailedGeocodingCanBeCaught()
199+
{
200+
$result = 'success';
201+
202+
try {
203+
app('geocoder')
204+
->geocode('asd,Afghanistan')
205+
->get();
206+
} catch (\Throwable $exception) {
207+
$result = 'failure';
208+
}
209+
210+
$this->assertEquals('failure', $result);
211+
}
197212
}

0 commit comments

Comments
 (0)