Change file name

This commit is contained in:
2024-09-26 09:58:43 +01:00
parent 2aa5cb731e
commit ab4bbd0574

View File

@@ -16,7 +16,7 @@ use Symfony\Bundle\FrameworkBundle\Test\KernelTestCase;
/** /**
* We sleep 1 second after API calls to prevent breaking the API T&Cs. * We sleep 1 second after API calls to prevent breaking the API T&Cs.
*/ */
final class GeocodeTest extends KernelTestCase final class GeocoderTest extends KernelTestCase
{ {
// Buckingham Palace // Buckingham Palace
private const string POSTCODE = 'SW1A 1AA'; private const string POSTCODE = 'SW1A 1AA';
@@ -30,17 +30,12 @@ final class GeocodeTest extends KernelTestCase
$this->geocoder = $kernel->getContainer()->get('pcm_geocode.geocoder'); $this->geocoder = $kernel->getContainer()->get('pcm_geocode.geocoder');
} }
public function testGeocodeInstance(): void
{
$this->assertInstanceOf(Geocoder::class, $this->geocoder);
}
public function testGeocodePostcodeThrowsOnEmptyInput(): void public function testGeocodePostcodeThrowsOnEmptyInput(): void
{ {
sleep(1); sleep(1);
$this->expectException(ApiErrorException::class); $this->expectException(ApiErrorException::class);
$this->expectExceptionMessageMatches("/Nothing to search for.$/"); $this->expectExceptionMessageMatches("/Nothing to search for.$/");
$this->geocoder->geocodePostcode(''); $this->geocoder->geocode('');
} }
public function testGeocodePostcodeThrowsOnInvalidPostcode(): void public function testGeocodePostcodeThrowsOnInvalidPostcode(): void
@@ -48,13 +43,13 @@ final class GeocodeTest extends KernelTestCase
sleep(1); sleep(1);
$this->expectException(NoResultsFoundException::class); $this->expectException(NoResultsFoundException::class);
$this->expectExceptionMessageMatches("/No results found.$/"); $this->expectExceptionMessageMatches("/No results found.$/");
$this->geocoder->geocodePostcode('ZZZZZZZZZZZZ'); $this->geocoder->geocode('ZZZZZZZZZZZZ');
} }
public function testGeocodePostcodeReturnsGeoCoordinates(): GeoCoordinates public function testGeocodePostcodeReturnsGeoCoordinates(): GeoCoordinates
{ {
sleep(1); sleep(1);
$geoCoords = $this->geocoder->geocodePostcode(self::POSTCODE); $geoCoords = $this->geocoder->geocode(self::POSTCODE);
$this->assertNotNull($geoCoords); $this->assertNotNull($geoCoords);
return $geoCoords; return $geoCoords;