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