/**
  * Test for geo distance aggregation.
  *
  * @param array $queryData
  * @param array $expectedResults
  *
  * @dataProvider getGeoDistanceAggregationData
  */
 public function testGeoDistanceAggregation($queryData, $expectedResults)
 {
     $repo = $this->getManager()->getRepository('AcmeTestBundle:Product');
     $agg = new GeoDistanceAggregation('test_agg');
     $agg->setField($queryData['field']);
     $agg->setUnit($queryData['unit']);
     $agg->addRange($queryData['range'][0], $queryData['range'][1]);
     $agg->setOrigin($queryData['origin']);
     if (array_key_exists('distance_type', $queryData)) {
         $agg->setDistanceType($queryData['distance_type']);
     }
     $search = $repo->createSearch()->addAggregation($agg);
     $results = $repo->execute($search, Repository::RESULTS_RAW)['aggregations']['agg_test_agg'];
     $this->assertEquals($expectedResults, $results['buckets']);
 }
 /**
  * Tests getType method.
  */
 public function testGeoDistanceAggregationGetType()
 {
     $aggregation = new GeoDistanceAggregation('foo');
     $result = $aggregation->getType();
     $this->assertEquals('geo_distance', $result);
 }