/**
  * Data provider for testToArray.
  *
  * @return array
  */
 public function getToArrayData()
 {
     $out = [];
     // Case #0 filter aggregation.
     $aggregation = new FilterAggregation('test_agg');
     $filter = new MatchAllFilter();
     $aggregation->setFilter($filter);
     $result = ['filter' => [$filter->getType() => $filter->toArray()]];
     $out[] = [$aggregation, $result];
     // Case #1 nested filter aggregation.
     $aggregation = new FilterAggregation('test_agg');
     $aggregation->setFilter($filter);
     $histogramAgg = new HistogramAggregation('acme', 'bar', 10);
     $aggregation->addAggregation($histogramAgg);
     $result = ['filter' => [$filter->getType() => $filter->toArray()], 'aggregations' => [$histogramAgg->getName() => $histogramAgg->toArray()]];
     $out[] = [$aggregation, $result];
     // Case #2 testing bool filter.
     $aggregation = new FilterAggregation('test_agg');
     $matchAllFilter = new MatchAllFilter();
     $termFilter = new TermFilter('acme', 'foo');
     $boolFilter = new BoolFilter();
     $boolFilter->add($matchAllFilter);
     $boolFilter->add($termFilter);
     $aggregation->setFilter($boolFilter);
     $result = ['filter' => [$boolFilter->getType() => $boolFilter->toArray()]];
     $out[] = [$aggregation, $result];
     return $out;
 }
 /**
  * Test getType method.
  */
 public function testBoolGetType()
 {
     $bool = new BoolFilter();
     $result = $bool->getType();
     $this->assertEquals('bool', $result);
 }