]> git.openstreetmap.org Git - nominatim.git/commitdiff
fix unit tests for class types
authorSarah Hoffmann <lonvia@denofr.de>
Thu, 12 Jul 2018 21:59:29 +0000 (23:59 +0200)
committerSarah Hoffmann <lonvia@denofr.de>
Thu, 12 Jul 2018 21:59:29 +0000 (23:59 +0200)
lib/lib.php
test/php/Nominatim/LibTest.php

index 8255aa4632150a4a312a67ce686b3b7d7e0ef612..a749cb6bd65842b5264f17ae2b23c0033aa1aa3e 100644 (file)
@@ -1,7 +1,5 @@
 <?php
 
-require_once(CONST_BasePath.'/lib/ClassTypes.php');
-
 function fail($sError, $sUserError = false)
 {
     if (!$sUserError) $sUserError = $sError;
index 533188adea7c98e612a1d645e68eccb8c1864cc2..55ae1aaa055eaf93dfb4693bdf9c9b33edf77381 100644 (file)
@@ -3,12 +3,13 @@
 namespace Nominatim;
 
 require_once '../../lib/lib.php';
+require_once '../../lib/ClassTypes.php';
 
 class LibTest extends \PHPUnit_Framework_TestCase
 {
     public function testGetClassTypesWithImportance()
     {
-        $aClasses = getClassTypesWithImportance();
+        $aClasses = ClassTypes\getListWithImportance();
 
         $this->assertGreaterThan(
             200,
@@ -31,22 +32,22 @@ class LibTest extends \PHPUnit_Framework_TestCase
 
     public function testGetResultDiameter()
     {
-        $aResult = array();
+        $aResult = array('class' => '', 'type' => '');
         $this->assertEquals(
             0.0001,
-            getResultDiameter($aResult)
+            ClassTypes\getProperty($aResult, 'defdiameter', 0.0001)
         );
 
         $aResult = array('class' => 'place', 'type' => 'country');
         $this->assertEquals(
             15,
-            getResultDiameter($aResult)
+            ClassTypes\getProperty($aResult, 'defdiameter', 0.0001)
         );
 
         $aResult = array('class' => 'boundary', 'type' => 'administrative', 'admin_level' => 6);
         $this->assertEquals(
             0.32,
-            getResultDiameter($aResult)
+            ClassTypes\getProperty($aResult, 'defdiameter', 0.0001)
         );
     }