mirror of
https://github.com/osm-search/Nominatim.git
synced 2026-03-07 18:44:07 +00:00
fix unit tests for class types
This commit is contained in:
@@ -1,7 +1,5 @@
|
|||||||
<?php
|
<?php
|
||||||
|
|
||||||
require_once(CONST_BasePath.'/lib/ClassTypes.php');
|
|
||||||
|
|
||||||
function fail($sError, $sUserError = false)
|
function fail($sError, $sUserError = false)
|
||||||
{
|
{
|
||||||
if (!$sUserError) $sUserError = $sError;
|
if (!$sUserError) $sUserError = $sError;
|
||||||
|
|||||||
@@ -3,12 +3,13 @@
|
|||||||
namespace Nominatim;
|
namespace Nominatim;
|
||||||
|
|
||||||
require_once '../../lib/lib.php';
|
require_once '../../lib/lib.php';
|
||||||
|
require_once '../../lib/ClassTypes.php';
|
||||||
|
|
||||||
class LibTest extends \PHPUnit_Framework_TestCase
|
class LibTest extends \PHPUnit_Framework_TestCase
|
||||||
{
|
{
|
||||||
public function testGetClassTypesWithImportance()
|
public function testGetClassTypesWithImportance()
|
||||||
{
|
{
|
||||||
$aClasses = getClassTypesWithImportance();
|
$aClasses = ClassTypes\getListWithImportance();
|
||||||
|
|
||||||
$this->assertGreaterThan(
|
$this->assertGreaterThan(
|
||||||
200,
|
200,
|
||||||
@@ -31,22 +32,22 @@ class LibTest extends \PHPUnit_Framework_TestCase
|
|||||||
|
|
||||||
public function testGetResultDiameter()
|
public function testGetResultDiameter()
|
||||||
{
|
{
|
||||||
$aResult = array();
|
$aResult = array('class' => '', 'type' => '');
|
||||||
$this->assertEquals(
|
$this->assertEquals(
|
||||||
0.0001,
|
0.0001,
|
||||||
getResultDiameter($aResult)
|
ClassTypes\getProperty($aResult, 'defdiameter', 0.0001)
|
||||||
);
|
);
|
||||||
|
|
||||||
$aResult = array('class' => 'place', 'type' => 'country');
|
$aResult = array('class' => 'place', 'type' => 'country');
|
||||||
$this->assertEquals(
|
$this->assertEquals(
|
||||||
15,
|
15,
|
||||||
getResultDiameter($aResult)
|
ClassTypes\getProperty($aResult, 'defdiameter', 0.0001)
|
||||||
);
|
);
|
||||||
|
|
||||||
$aResult = array('class' => 'boundary', 'type' => 'administrative', 'admin_level' => 6);
|
$aResult = array('class' => 'boundary', 'type' => 'administrative', 'admin_level' => 6);
|
||||||
$this->assertEquals(
|
$this->assertEquals(
|
||||||
0.32,
|
0.32,
|
||||||
getResultDiameter($aResult)
|
ClassTypes\getProperty($aResult, 'defdiameter', 0.0001)
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user