From b9cce726865dbe28097f1c33496b447a5d76ff2c Mon Sep 17 00:00:00 2001 From: Peter Baettig Date: Mon, 20 Jan 2020 19:56:10 +0100 Subject: [PATCH] fix empty radius --- app/SwissGeo.php | 2 +- tests/SwissGeo/SwissGeoTest.php | 1 + 2 files changed, 2 insertions(+), 1 deletion(-) diff --git a/app/SwissGeo.php b/app/SwissGeo.php index f02ade6..33a5d75 100644 --- a/app/SwissGeo.php +++ b/app/SwissGeo.php @@ -50,7 +50,7 @@ public static function findPointByAddress(string $location): ?array return ['x' => $firstElement['attrs']['x'], 'y' => $firstElement['attrs']['y']]; } - public static function findCitiesNearPoint(float $x, float $y, float $radius): ?array + public static function findCitiesNearPoint(float $x, float $y, float $radius = 0): ?array { $locations = GeoAdminGateway::getLocationsByGeometryPoint($x, $y, $radius); if (count($locations['results']) === 0) { diff --git a/tests/SwissGeo/SwissGeoTest.php b/tests/SwissGeo/SwissGeoTest.php index 9762118..c8606ac 100644 --- a/tests/SwissGeo/SwissGeoTest.php +++ b/tests/SwissGeo/SwissGeoTest.php @@ -23,6 +23,7 @@ public function testFindPointByAddress() public function testFindCitiesNearPoint() { $this->assertCount(2,SwissGeo::findCitiesNearPoint(210318.1875, 657089.5,1.5)); + $this->assertCount(1,SwissGeo::findCitiesNearPoint(210318.1875, 657089.5)); } public function testFindPostcodeByCity()