/**
  * Test the getGeographicalQueryAnnotation method of the AnnotationDriver.
  */
 public function testGetGeographicalQueryAnnotation()
 {
     $this->geographicalQueryAnnotation->expects($this->once())->method('getMethod')->will($this->returnValue('getAddress'));
     $this->reader->expects($this->once())->method('getMethodAnnotation')->with($this->isInstanceOf('\\ReflectionMethod'), $this->equalTo('Vich\\GeographicalBundle\\Annotation\\GeographicalQuery'))->will($this->returnValue($this->geographicalQueryAnnotation));
     $annot = $this->driver->getGeographicalQueryAnnotation($this->geographicalEntity);
     $this->assertNotNull($annot);
     $this->assertEquals('getAddress', $annot->getMethod());
 }
 /**
  * Test the prePersist method of the GeographicalListener.
  */
 public function testPrePersist()
 {
     $this->lifecycleArgs->expects($this->once())->method('getEntity')->will($this->returnValue($this->geographicalEntity));
     $this->geographicalAnnotation->expects($this->once())->method('getLat')->will($this->returnValue('latitude'));
     $this->geographicalAnnotation->expects($this->once())->method('getLng')->will($this->returnValue('longitude'));
     $this->geographicalQueryAnnotation->expects($this->once())->method('getMethod')->will($this->returnValue('getAddress'));
     $this->queryService->expects($this->once())->method('queryForCoordinates')->with($this->anything())->will($this->returnValue($this->queryResult));
     $this->queryResult->expects($this->once())->method('getLatitude')->will($this->returnValue(50));
     $this->queryResult->expects($this->once())->method('getLongitude')->will($this->returnValue(-50));
     $this->driver->expects($this->once())->method('getGeographicalAnnotation')->will($this->returnValue($this->geographicalAnnotation));
     $this->driver->expects($this->once())->method('getGeographicalQueryAnnotation')->will($this->returnValue($this->geographicalQueryAnnotation));
     $this->listener->prePersist($this->lifecycleArgs);
     $this->assertEquals(50, $this->geographicalEntity->getLatitude());
     $this->assertEquals(-50, $this->geographicalEntity->getLongitude());
 }