]> git.openstreetmap.org Git - nominatim.git/blobdiff - test/php/Nominatim/NearPointTest.php
fix more tests
[nominatim.git] / test / php / Nominatim / NearPointTest.php
index 4d1a5b43d23a9653893efa77371ed6617aab991b..6fa9b515078a2e6264aad08e53c14ac86559c938 100644 (file)
@@ -6,6 +6,8 @@ require '../../lib/NearPoint.php';
 
 class NearPointTest extends \PHPUnit_Framework_TestCase
 {
 
 class NearPointTest extends \PHPUnit_Framework_TestCase
 {
+
+
     protected function setUp()
     {
     }
     protected function setUp()
     {
     }
@@ -65,4 +67,24 @@ class NearPointTest extends \PHPUnit_Framework_TestCase
             $this->assertEquals(-79.982, $aRes['pt']->lon(), 'degrees decimal ' . $sQuery, 0.01);
         }
     }
             $this->assertEquals(-79.982, $aRes['pt']->lon(), 'degrees decimal ' . $sQuery, 0.01);
         }
     }
+
+    public function testWithinSQL()
+    {
+        $np = new NearPoint(0.1, 23, 1);
+
+        $this->assertEquals(
+            'ST_DWithin(foo, ST_SetSRID(ST_Point(23,0.1),4326), 1.000000)',
+            $np->withinSQL('foo')
+        );
+    }
+
+    public function testDistanceSQL()
+    {
+        $np = new NearPoint(0.1, 23, 1);
+
+        $this->assertEquals(
+            'ST_Distance(ST_SetSRID(ST_Point(23,0.1),4326), foo)',
+            $np->distanceSQL('foo')
+        );
+    }
 }
 }