/**
  * Tests getArray method.
  */
 public function testGeoBoundsAggregationGetArray()
 {
     $agg = new GeoBoundsAggregation('foo');
     $agg->setField('bar');
     $agg->setWrapLongitude(true);
     $result = ['agg_foo' => ['geo_bounds' => ['field' => 'bar', 'wrap_longitude' => true]]];
     $this->assertEquals($result, $agg->toArray(), 'when wraplongitude is true');
     $agg->setWrapLongitude(false);
     $result = ['agg_foo' => ['geo_bounds' => ['field' => 'bar', 'wrap_longitude' => false]]];
     $this->assertEquals($result, $agg->toArray(), 'when wraplongitude is false');
 }
 /**
  * Test for geo bounds aggregation with match query.
  */
 public function testGeoBoundsAggregation()
 {
     $repo = $this->getManager()->getRepository('AcmeTestBundle:Product');
     $query = new MatchQuery('price', 100);
     $agg = new GeoBoundsAggregation('test_agg');
     $agg->setWrapLongitude(false);
     $agg->setField('location');
     $search = $repo->createSearch()->addQuery($query);
     $search->addAggregation($agg);
     $results = $repo->execute($search, $repo::RESULTS_RAW)['aggregations'];
     $expectedResult = ['agg_test_agg' => ['bounds' => ['top_left' => ['lat' => 55.55, 'lon' => -80.66], 'bottom_right' => ['lat' => 40, 'lon' => -66.66]]]];
     $this->assertEquals($expectedResult, $results);
 }