diff --git a/CHANGELOG.md b/CHANGELOG.md index f54f8d3..dd808cd 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -12,7 +12,7 @@ All Notable changes to `jobs-govt` will be documented in this file - Nothing ### Fixed -- Nothing +- Added " in " to search string when looking for locations to correct erroneous results ### Removed - Nothing diff --git a/src/Govt.php b/src/Govt.php index 0e0e08f..a806d9f 100644 --- a/src/Govt.php +++ b/src/Govt.php @@ -119,7 +119,7 @@ public function getListingsPath() */ public function getKeyword() { - $keyword = ($this->keyword ? $this->keyword.' ' : null).($this->getLocation() ?: null); + $keyword = ($this->keyword ? $this->keyword : null).($this->getLocation() ? ' in '.$this->getLocation() : null); if ($keyword) { return $keyword; diff --git a/tests/src/GovtTest.php b/tests/src/GovtTest.php index eba6493..e9a0656 100644 --- a/tests/src/GovtTest.php +++ b/tests/src/GovtTest.php @@ -58,7 +58,7 @@ public function testUrlIncludesKeywordWhenCityAndStateProvided() { $city = uniqid(); $state = uniqid(); - $param = 'query='.urlencode($city.', '.$state); + $param = 'query='.urlencode(' in '.$city.', '.$state); $url = $this->client->setCity($city)->setState($state)->getUrl(); @@ -68,7 +68,7 @@ public function testUrlIncludesKeywordWhenCityAndStateProvided() public function testUrlIncludesKeywordWhenCityProvided() { $city = uniqid(); - $param = 'query='.urlencode($city); + $param = 'query='.urlencode(' in '.$city); $url = $this->client->setCity($city)->getUrl(); @@ -78,7 +78,7 @@ public function testUrlIncludesKeywordWhenCityProvided() public function testUrlIncludesKeywordWhenStateProvided() { $state = uniqid(); - $param = 'query='.urlencode($state); + $param = 'query='.urlencode(' in '.$state); $url = $this->client->setState($state)->getUrl();