/**
  * Test getArray method.
  */
 public function testGetArray()
 {
     $aggregation = new PercentilesAggregation('bar', 'fieldValue', ['percentsValue']);
     $this->assertSame(['percents' => ['percentsValue'], 'field' => 'fieldValue'], $aggregation->getArray());
 }
 /**
  * Tests if PercentilesAggregation#getArray throws exception when expected.
  *
  * @expectedException \LogicException
  * @expectedExceptionMessage Percentiles aggregation must have field or script set.
  */
 public function testPercentilesAggregationGetArrayException()
 {
     $aggregation = new PercentilesAggregation('bar');
     $aggregation->getArray();
 }