/**
  * Test GetArray method.
  */
 public function testFiltersAggregationGetArray()
 {
     $mock = $this->getMockBuilder('ONGR\\ElasticsearchBundle\\DSL\\BuilderInterface')->getMock();
     $aggregation = new FiltersAggregation('test_agg');
     $aggregation->setAnonymous(true);
     $aggregation->addFilter($mock, 'name');
     $result = $aggregation->getArray();
     $this->assertArrayHasKey('filters', $result);
 }
 /**
  * Test for anonymous filters.
  */
 public function testAnonymousFiltersAggregation()
 {
     $repo = $this->getManager()->getRepository('AcmeTestBundle:Product');
     $aggregation = new FiltersAggregation('test_agg');
     $aggregation->setAnonymous(true);
     $aggregation->addFilter(new TermFilter('title', 'bar'));
     $search = $repo->createSearch()->addAggregation($aggregation);
     $results = $repo->execute($search, Repository::RESULTS_RAW);
     $this->assertEquals(1, $results['aggregations']['agg_test_agg']['buckets'][0]['doc_count']);
 }