/**
  * Test getArray method.
  */
 public function testMissingAggregationGetArray()
 {
     $aggregation = new MissingAggregation('foo');
     $aggregation->setField('bar');
     $result = $aggregation->getArray();
     $this->assertEquals('bar', $result['field']);
 }
 /**
  * Test for missing aggregation.
  */
 public function testMissingAggregation()
 {
     $repo = $this->getManager()->getRepository('AcmeTestBundle:Product');
     $agg = new MissingAggregation('missing_prices');
     $agg->setField('price');
     $search = $repo->createSearch()->addAggregation($agg);
     $results = $repo->execute($search, $repo::RESULTS_RAW);
     $expectedResult = ['agg_missing_prices' => ['doc_count' => 2]];
     $this->assertArrayHasKey('aggregations', $results);
     $this->assertEquals($expectedResult, $results['aggregations']);
 }