more API tests for code coverage

Also fixes two minor issues related to structured queries.
This commit is contained in:
Sarah Hoffmann
2017-09-17 23:30:08 +02:00
parent 2dbf58d461
commit a0de20e9bc
4 changed files with 64 additions and 4 deletions

View File

@@ -304,7 +304,7 @@ class Geocode
$aViewbox = $oParams->getStringList('viewboxlbrt');
if ($aViewbox) {
if (count($aViewbox) != 4) {
userError("Bad parmater 'viewbox'. Expected 4 coordinates.");
userError("Bad parmater 'viewboxlbrt'. Expected 4 coordinates.");
}
$this->setViewbox($aViewbox);
} else {
@@ -372,7 +372,7 @@ class Geocode
$this->aAddressRankList = array();
$this->aStructuredQuery = array();
$this->sAllowedTypesSQLList = '';
$this->sAllowedTypesSQLList = False;
$this->loadStructuredAddressElement($sAmenity, 'amenity', 26, 30, false);
$this->loadStructuredAddressElement($sStreet, 'street', 26, 30, false);
@@ -385,7 +385,7 @@ class Geocode
if (sizeof($this->aStructuredQuery) > 0) {
$this->sQuery = join(', ', $this->aStructuredQuery);
if ($this->iMaxAddressRank < 30) {
$sAllowedTypesSQLList = '(\'place\',\'boundary\')';
$this->sAllowedTypesSQLList = '(\'place\',\'boundary\')';
}
}
}
@@ -1403,7 +1403,7 @@ class Geocode
if ($aSearch['sCountryCode']) $aTerms[] = "country_code = '".pg_escape_string($aSearch['sCountryCode'])."'";
if ($aSearch['sHouseNumber']) {
$aTerms[] = "address_rank between 16 and 27";
} else {
} elseif (!$aSearch['sClass'] || $aSearch['sOperator'] == 'name') {
if ($this->iMinAddressRank > 0) {
$aTerms[] = "address_rank >= ".$this->iMinAddressRank;
}