boot(); $this->geocoder = $kernel->getContainer()->get('pcm_geocode.geocoder'); } public function testGeocodePostcodeThrowsOnEmptyInput(): void { sleep(1); $this->expectException(ApiErrorException::class); $this->expectExceptionMessageMatches("/Nothing to search for.$/"); $this->geocoder->geocode(''); } public function testGeocodePostcodeThrowsOnInvalidPostcode(): void { sleep(1); $this->expectException(NoResultsFoundException::class); $this->expectExceptionMessageMatches("/No results found.$/"); $this->geocoder->geocode('ZZZZZZZZZZZZ'); } public function testGeocodePostcodeReturnsGeoCoordinates(): GeoCoordinates { sleep(1); $geoCoords = $this->geocoder->geocode(self::POSTCODE); $this->assertNotNull($geoCoords); return $geoCoords; } /** * @depends testGeocodePostcodeReturnsGeoCoordinates */ public function testCoordinatesAreSet(GeoCoordinates $geoCoordinates): void { $this->assertIsFloat($geoCoordinates->latitude); $this->assertIsFloat($geoCoordinates->longitude); } private function getGeocodableEntity(): GeocodeInterface { return new class implements GeocodeInterface { use GeocodeTrait; }; } }