5 require_once(CONST_BasePath.'/lib/ClassTypes.php');
 
   7 class ClassTypesTest extends \PHPUnit\Framework\TestCase
 
   9     public function testGetInfo()
 
  13         // https://nominatim.openstreetmap.org/details.php?osmtype=R&osmid=1109531
 
  16                    'class' => 'boundary',
 
  17                    'type' => 'administrative',
 
  21         $this->assertEquals('County', ClassTypes\getInfo($aPlace)['label']);
 
  22         $this->assertEquals('County', ClassTypes\getFallbackInfo($aPlace)['label']);
 
  23         $this->assertEquals('County', ClassTypes\getProperty($aPlace, 'label'));
 
  27         // https://nominatim.openstreetmap.org/details.php?osmtype=W&osmid=5013364
 
  30                    'type' => 'attraction',
 
  33         $this->assertEquals('Attraction', ClassTypes\getInfo($aPlace)['label']);
 
  34         $this->assertEquals(array('simplelabel' => 'address29'), ClassTypes\getFallbackInfo($aPlace));
 
  35         $this->assertEquals('Attraction', ClassTypes\getProperty($aPlace, 'label'));
 
  38         // La Maison du Toutou, Paris
 
  39         // https://nominatim.openstreetmap.org/details.php?osmtype=W&osmid=164011651
 
  42                    'type' => 'pet_grooming',
 
  45         $this->assertEquals(false, ClassTypes\getInfo($aPlace));
 
  46         $this->assertEquals(array('simplelabel' => 'address29'), ClassTypes\getFallbackInfo($aPlace));
 
  47         $this->assertEquals(false, ClassTypes\getProperty($aPlace, 'label'));
 
  48         $this->assertEquals('mydefault', ClassTypes\getProperty($aPlace, 'label', 'mydefault'));
 
  51     public function testGetClassTypesWithImportance()
 
  53         $aClasses = ClassTypes\getListWithImportance();
 
  55         $this->assertGreaterThan(
 
  64              'icon' => 'poi_boundary_administrative',
 
  69             $aClasses['place:country']
 
  74     public function testGetResultDiameter()
 
  76         $aResult = array('class' => '', 'type' => '');
 
  79             ClassTypes\getProperty($aResult, 'defdiameter', 0.0001)
 
  82         $aResult = array('class' => 'place', 'type' => 'country');
 
  85             ClassTypes\getProperty($aResult, 'defdiameter', 0.0001)
 
  88         $aResult = array('class' => 'boundary', 'type' => 'administrative', 'admin_level' => 6);
 
  91             ClassTypes\getProperty($aResult, 'defdiameter', 0.0001)