/**
  * Test the getGeographicalAnnotation method of the AnnotationDriver.
  */
 public function testGetGeographicalAnnotation()
 {
     $this->geographicalAnnotation->expects($this->once())->method('getLat')->will($this->returnValue('latitude'));
     $this->geographicalAnnotation->expects($this->once())->method('getLng')->will($this->returnValue('longitude'));
     $this->reader->expects($this->once())->method('getClassAnnotation')->with($this->isInstanceOf('\\ReflectionClass'), $this->equalTo('Vich\\GeographicalBundle\\Annotation\\Geographical'))->will($this->returnValue($this->geographicalAnnotation));
     $annot = $this->driver->getGeographicalAnnotation($this->geographicalEntity);
     $this->assertNotNull($annot);
     $this->assertEquals('latitude', $annot->getLat());
     $this->assertEquals('longitude', $annot->getLng());
 }
 /**
  * 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());
 }