From e87294e96f2896013d7e82605b9272f0067a971c Mon Sep 17 00:00:00 2001 From: Brabli <67018167+Brabli@users.noreply.github.com> Date: Thu, 21 Jul 2022 14:46:51 +0100 Subject: [PATCH] Get tests passing --- src/Service/Geocoder.php | 10 +++++----- tests/Service/GeocodeTest.php | 6 +++--- 2 files changed, 8 insertions(+), 8 deletions(-) diff --git a/src/Service/Geocoder.php b/src/Service/Geocoder.php index 524a8c1..5643a68 100644 --- a/src/Service/Geocoder.php +++ b/src/Service/Geocoder.php @@ -5,8 +5,8 @@ declare(strict_types=1); namespace Pcm\GeocodeBundle\Service; use Exception; -use Pcm\GeocodeBundle\Data\LatLon; use Pcm\GeocodeBundle\Entity\GeocodeData; +use Pcm\GeocodeBundle\Model\LatLonModel; use Symfony\Contracts\HttpClient\HttpClientInterface; use Symfony\Contracts\HttpClient\ResponseInterface; @@ -17,12 +17,12 @@ class Geocoder public function __construct(private HttpClientInterface $client) {} /** - * Returns a LatLon object + * Returns a LatLonModel object * * @param string $postcode * @return GeocodeData */ - public function geocodePostcode(string $postcode): LatLon + public function geocodePostcode(string $postcode): LatLonModel { $client = $this->setClientHeaders(); $response = $this->makeApiRequest($client, $postcode); @@ -59,8 +59,8 @@ class Geocoder throw new Exception("No data was received from API response! Were the arguments valid?"); } - private function createGeocodeDataObject(array $data): LatLon + private function createGeocodeDataObject(array $data): LatLonModel { - return new LatLon((float) $data[0]['lat'], (float) $data[0]['lon']); + return new LatLonModel((float) $data[0]['lat'], (float) $data[0]['lon']); } } diff --git a/tests/Service/GeocodeTest.php b/tests/Service/GeocodeTest.php index 39b1752..c4b6931 100644 --- a/tests/Service/GeocodeTest.php +++ b/tests/Service/GeocodeTest.php @@ -4,8 +4,8 @@ declare(strict_types=1); namespace Pcm\GeocodeBundle\Tests; -use Pcm\GeocodeBundle\Data\LatLon; use Pcm\GeocodeBundle\Interface\MappableInterface; +use Pcm\GeocodeBundle\Model\LatLonModel; use Pcm\GeocodeBundle\Service\Geocoder; use Pcm\GeocodeBundle\Tests\AppKernel; use Pcm\GeocodeBundle\Trait\MappableTrait; @@ -37,11 +37,11 @@ class GeocodeTest extends KernelTestCase $this->geocoder->geocodePostcode('aaaaaaaa'); } - public function testGeocodePostcodeReturnsLatLonObject(): void + public function testGeocodePostcodeReturnsLatLonModel(): void { sleep(1); $result = $this->geocoder->geocodePostcode(self::POSTCODE); - $this->assertInstanceOf(LatLon::class, $result); + $this->assertInstanceOf(LatLonModel::class, $result); } private function getMappableEntity(): MappableInterface