From e4222229c48a9fb6aa672ab1cdb9946d16412971 Mon Sep 17 00:00:00 2001 From: brabli <67018167+Brabli@users.noreply.github.com> Date: Mon, 5 Aug 2024 12:28:25 +0100 Subject: [PATCH] Add test --- tests/Service/GeocodeTest.php | 17 ++++++++++++++--- 1 file changed, 14 insertions(+), 3 deletions(-) diff --git a/tests/Service/GeocodeTest.php b/tests/Service/GeocodeTest.php index 8976c4d..beb3241 100644 --- a/tests/Service/GeocodeTest.php +++ b/tests/Service/GeocodeTest.php @@ -39,11 +39,22 @@ final class GeocodeTest extends KernelTestCase $this->assertNull($this->geocoder->geocodePostcode('')); } - public function testGeocodePostcodeReturnsGeoCoordinates(): void + public function testGeocodePostcodeReturnsGeoCoordinates(): GeoCoordinates { sleep(1); - $result = $this->geocoder->geocodePostcode(self::POSTCODE); - $this->assertInstanceOf(GeoCoordinates::class, $result); + $geoCoords = $this->geocoder->geocodePostcode(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 getMappableEntity(): MappableInterface