]> git.openstreetmap.org Git - nominatim.git/blobdiff - test/php/Nominatim/ClassTypesTest.php
introduce mutation variants to generic token analyser
[nominatim.git] / test / php / Nominatim / ClassTypesTest.php
index 814e7cff6beec1d9da2736772d4cd1a5890afa2d..d2900d822b388bf9c58aea542037f01ec6fd6274 100644 (file)
@@ -1,49 +1,56 @@
 <?php
+/**
+ * SPDX-License-Identifier: GPL-2.0-only
+ *
+ * This file is part of Nominatim. (https://nominatim.org)
+ *
+ * Copyright (C) 2022 by the Nominatim developer community.
+ * For a full list of authors see the git log.
+ */
 
 namespace Nominatim;
 
-require_once(CONST_BasePath.'/lib/ClassTypes.php');
+require_once(CONST_LibDir.'/ClassTypes.php');
 
 class ClassTypesTest extends \PHPUnit\Framework\TestCase
 {
     public function testGetLabelTag()
     {
         $aPlace = array('class' => 'boundary', 'type' => 'administrative',
-                        'rank_address' => '4', 'place_type' => 'city');
+                   'rank_address' => '4', 'place_type' => 'city');
         $this->assertEquals('city', ClassTypes\getLabelTag($aPlace));
 
         $aPlace = array('class' => 'boundary', 'type' => 'administrative',
-                        'rank_address' => '10');
+                   'rank_address' => '10');
         $this->assertEquals('state_district', ClassTypes\getLabelTag($aPlace));
 
         $aPlace = array('class' => 'boundary', 'type' => 'administrative');
         $this->assertEquals('administrative', ClassTypes\getLabelTag($aPlace));
 
-        $aPlace = array('class' => 'place', 'type' => 'hamlet',
-                        'rank_address' => '20');
+        $aPlace = array('class' => 'place', 'type' => 'hamlet', 'rank_address' => '20');
         $this->assertEquals('hamlet', ClassTypes\getLabelTag($aPlace));
 
         $aPlace = array('class' => 'highway', 'type' => 'residential',
-                        'rank_address' => '26');
+                   'rank_address' => '26');
         $this->assertEquals('road', ClassTypes\getLabelTag($aPlace));
 
         $aPlace = array('class' => 'place', 'type' => 'house_number',
-                        'rank_address' => '30');
+                   'rank_address' => '30');
         $this->assertEquals('house_number', ClassTypes\getLabelTag($aPlace));
 
         $aPlace = array('class' => 'amenity', 'type' => 'prison',
-                        'rank_address' => '30');
+                   'rank_address' => '30');
         $this->assertEquals('amenity', ClassTypes\getLabelTag($aPlace));
     }
 
     public function testGetLabel()
     {
         $aPlace = array('class' => 'boundary', 'type' => 'administrative',
-                        'rank_address' => '4', 'place_type' => 'city');
+                   'rank_address' => '4', 'place_type' => 'city');
         $this->assertEquals('City', ClassTypes\getLabel($aPlace));
 
         $aPlace = array('class' => 'boundary', 'type' => 'administrative',
-                        'rank_address' => '10');
+                   'rank_address' => '10');
         $this->assertEquals('State District', ClassTypes\getLabel($aPlace));
 
         $aPlace = array('class' => 'boundary', 'type' => 'administrative');
@@ -62,6 +69,8 @@ class ClassTypesTest extends \PHPUnit\Framework\TestCase
         $this->assertEquals('Administrative', ClassTypes\getBoundaryLabel(18, null));
         $this->assertEquals('None', ClassTypes\getBoundaryLabel(18, null, 'None'));
         $this->assertEquals('State', ClassTypes\getBoundaryLabel(4, 'de', 'None'));
+        $this->assertEquals('County', ClassTypes\getBoundaryLabel(4, 'se', 'None'));
+        $this->assertEquals('Municipality', ClassTypes\getBoundaryLabel(7, 'se', 'None'));
     }
 
     public function testGetDefRadius()