diff --git a/src/Trait/Entity/GeocodeTrait.php b/src/Trait/Entity/GeocodeTrait.php index 6457805..98c843e 100644 --- a/src/Trait/Entity/GeocodeTrait.php +++ b/src/Trait/Entity/GeocodeTrait.php @@ -45,7 +45,7 @@ trait GeocodeTrait public function isGeocoded(): bool { - return null !== $this->getLatitude() && null !== $this->getLongitude(); + return null !== $this->getLatitude() && null !== $this->getLongitude() && (0.0 !== $this->getLatitude() && 0.0 !== $this->getLongitude()); } } diff --git a/tests/Trait/GeocodeTraitTest.php b/tests/Trait/GeocodeTraitTest.php index fcc8cfd..a802447 100644 --- a/tests/Trait/GeocodeTraitTest.php +++ b/tests/Trait/GeocodeTraitTest.php @@ -75,11 +75,18 @@ final class GeocodeTraitTest extends TestCase $this->assertTrue($this->obj->isGeocoded()); } - public function testIsGeocodeReturnsTrueIfLatAndLonAreBothZero(): void + public function testIsGeocodedReturnsFalseIfLatAndLonAreBothZero(): void { $this->obj->setLatitude(0.000); $this->obj->setLongitude(0.000); - $this->assertTrue($this->obj->isGeocoded()); + $this->assertFalse($this->obj->isGeocoded()); + } + + public function testIsGeocodedReturnsFalseIfLatAndLonAreBothZeroInts(): void + { + $this->obj->setLatitude(0); + $this->obj->setLongitude(0); + $this->assertFalse($this->obj->isGeocoded()); } private function getTraitObject(): GeocodeInterface