5 @define('CONST_BasePath', '../../');
 
   7 require_once '../../lib/SearchContext.php';
 
   9 class SearchContextTest extends \PHPUnit_Framework_TestCase
 
  14     protected function setUp()
 
  16         $this->oCtx = new SearchContext();
 
  19     public function testHasNearPoint()
 
  21         $this->assertFalse($this->oCtx->hasNearPoint());
 
  22         $this->oCtx->setNearPoint(0, 0);
 
  23         $this->assertTrue($this->oCtx->hasNearPoint());
 
  26     public function testNearRadius()
 
  28         $this->oCtx->setNearPoint(1, 1);
 
  29         $this->assertEquals(0.1, $this->oCtx->nearRadius());
 
  30         $this->oCtx->setNearPoint(1, 1, 0.338);
 
  31         $this->assertEquals(0.338, $this->oCtx->nearRadius());
 
  34     public function testWithinSQL()
 
  36         $this->oCtx->setNearPoint(0.1, 23, 1);
 
  39             'ST_DWithin(foo, ST_SetSRID(ST_Point(23,0.1),4326), 1.000000)',
 
  40             $this->oCtx->withinSQL('foo')
 
  44     public function testDistanceSQL()
 
  46         $this->oCtx->setNearPoint(0.1, 23, 1);
 
  49             'ST_Distance(ST_SetSRID(ST_Point(23,0.1),4326), foo)',
 
  50             $this->oCtx->distanceSQL('foo')