/**
  * Test for reverse_nested aggregation toArray() without path.
  */
 public function testToArrayNoPath()
 {
     $termAggregation = new TermsAggregation('acme');
     $aggregation = new ReverseNestedAggregation('test_nested_agg');
     $aggregation->addAggregation($termAggregation);
     $expectedResult = ['reverse_nested' => new \stdClass(), 'aggregations' => [$termAggregation->getName() => $termAggregation->toArray()]];
     $this->assertEquals(json_encode($expectedResult), json_encode($aggregation->toArray()));
 }
 /**
  * Test for reverse_nested aggregation toArray() without path.
  */
 public function testToArrayNoPath()
 {
     $termMock = $this->getMockBuilder('ONGR\\ElasticsearchDSL\\Aggregation\\TermsAggregation')->disableOriginalConstructor()->getMock();
     $termMock->expects($this->once())->method('toArray')->will($this->returnValue(['terms' => []]));
     $aggregation = new ReverseNestedAggregation('test_nested_agg');
     $aggregation->addAggregation($termMock);
     $expectedResult = ['agg_test_nested_agg' => ['reverse_nested' => new \stdClass(), 'aggregations' => ['terms' => []]]];
     $this->assertEquals($expectedResult, $aggregation->toArray());
 }