- // 1) Admin level set
- // city Dublin
- // https://nominatim.openstreetmap.org/details.php?osmtype=R&osmid=1109531
- $aPlace = array(
- 'admin_level' => 7,
- 'class' => 'boundary',
- 'type' => 'administrative',
- 'rank_address' => 14
- );
-
- $this->assertEquals('Municipality', ClassTypes\getInfo($aPlace)['label']);
- $this->assertEquals('Municipality', ClassTypes\getFallbackInfo($aPlace)['label']);
- $this->assertEquals('Municipality', ClassTypes\getProperty($aPlace, 'label'));
-
- // 2) No admin level
- // Eiffel Tower
- // https://nominatim.openstreetmap.org/details.php?osmtype=W&osmid=5013364
- $aPlace = array(
- 'class' => 'tourism',
- 'type' => 'attraction',
- 'rank_address' => 29
- );
- $this->assertEquals('Attraction', ClassTypes\getInfo($aPlace)['label']);
- $this->assertEquals(array('simplelabel' => 'address29'), ClassTypes\getFallbackInfo($aPlace));
- $this->assertEquals('Attraction', ClassTypes\getProperty($aPlace, 'label'));
-
- // 3) Unknown type
- // La Maison du Toutou, Paris
- // https://nominatim.openstreetmap.org/details.php?osmtype=W&osmid=164011651
- $aPlace = array(
- 'class' => 'shop',
- 'type' => 'pet_grooming',
- 'rank_address' => 29
- );
- $this->assertEquals(false, ClassTypes\getInfo($aPlace));
- $this->assertEquals(array('simplelabel' => 'address29'), ClassTypes\getFallbackInfo($aPlace));
- $this->assertEquals(false, ClassTypes\getProperty($aPlace, 'label'));
- $this->assertEquals('mydefault', ClassTypes\getProperty($aPlace, 'label', 'mydefault'));
+ $aPlace = array('class' => 'boundary', 'type' => 'administrative',
+ 'rank_address' => '4', 'place_type' => 'city');
+ $this->assertEquals('city', ClassTypes\getLabelTag($aPlace));
+
+ $aPlace = array('class' => 'boundary', 'type' => 'administrative',
+ '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');
+ $this->assertEquals('hamlet', ClassTypes\getLabelTag($aPlace));
+
+ $aPlace = array('class' => 'highway', 'type' => 'residential',
+ 'rank_address' => '26');
+ $this->assertEquals('road', ClassTypes\getLabelTag($aPlace));
+
+ $aPlace = array('class' => 'place', 'type' => 'house_number',
+ 'rank_address' => '30');
+ $this->assertEquals('house_number', ClassTypes\getLabelTag($aPlace));
+
+ $aPlace = array('class' => 'amenity', 'type' => 'prison',
+ 'rank_address' => '30');
+ $this->assertEquals('amenity', ClassTypes\getLabelTag($aPlace));