diff --git a/lib/output.php b/lib/output.php
index 9d4b7502..8715efbc 100644
--- a/lib/output.php
+++ b/lib/output.php
@@ -48,5 +48,5 @@ function detailsPermaLink($aFeature, $sRefText = false)
$sLabel = $sRefText ? $sRefText : $sOSMType.' '.$aFeature['osm_id'];
return ''.$sLabel.'';
}
- return '';
+ return detailsLink($aFeature, $sRefText);
}
diff --git a/test/php/Nominatim/OutputTest.php b/test/php/Nominatim/OutputTest.php
new file mode 100644
index 00000000..ce9bfa35
--- /dev/null
+++ b/test/php/Nominatim/OutputTest.php
@@ -0,0 +1,57 @@
+ 'N', 'osm_id'=> 38274, 'class' => 'place');
+ $this->assertSame(
+ detailsPermaLink($aFeature),
+ 'node 38274'
+ );
+ }
+
+ public function testDetailsPermaLinkWay()
+ {
+ $aFeature = array('osm_type' => 'W', 'osm_id'=> 65, 'class' => 'highway');
+ $this->assertSame(
+ detailsPermaLink($aFeature),
+ 'way 65'
+ );
+ }
+
+ public function testDetailsPermaLinkRelation()
+ {
+ $aFeature = array('osm_type' => 'R', 'osm_id'=> 9908, 'class' => 'waterway');
+ $this->assertSame(
+ detailsPermaLink($aFeature),
+ 'relation 9908'
+ );
+ }
+
+ public function testDetailsPermaLinkTiger()
+ {
+ $aFeature = array('osm_type' => 'T', 'osm_id'=> 2, 'place_id' => 334);
+ $this->assertSame(
+ detailsPermaLink($aFeature, 'foo'),
+ 'foo'
+ );
+ }
+
+ public function testDetailsPermaLinkInterpolation()
+ {
+ $aFeature = array('osm_type' => 'I', 'osm_id'=> 400, 'place_id' => 3);
+ $this->assertSame(
+ detailsPermaLink($aFeature, 'foo'),
+ 'foo'
+ );
+ }
+
+
+
+
+}