コード例 #1
0
 /**
  * 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']);
 }
コード例 #2
0
 /**
  * Test getType method.
  */
 public function testMissingAggregationGetType()
 {
     $aggregation = new MissingAggregation('bar');
     $result = $aggregation->getType();
     $this->assertEquals('missing', $result);
 }