Skip to content
Snippets Groups Projects
Commit 45033ff6 authored by Alexander Gorbatenko's avatar Alexander Gorbatenko Committed by Simonas Šerlinskas
Browse files

Fixed bug on nested and reverse nested aggregations. None of these...

Fixed bug on nested and reverse nested aggregations. None of these aggregations requires the nested aggregations to be added. Test has also been updated. (#173)
parent 9a6da568
No related branches found
No related tags found
No related merge requests found
......@@ -74,10 +74,6 @@ class ReverseNestedAggregation extends AbstractAggregation
*/
public function getArray()
{
if (count($this->getAggregations()) == 0) {
throw new \LogicException("Reverse Nested aggregation `{$this->getName()}` has no aggregations added");
}
$output = new \stdClass();
if ($this->getPath()) {
$output = ['path' => $this->getPath()];
......
......@@ -17,23 +17,6 @@ use ONGR\ElasticsearchDSL\Aggregation\TermsAggregation;
class ReverseNestedAggregationTest extends \PHPUnit_Framework_TestCase
{
/**
* Test for reverse_nested aggregation toArray() method exception.
*
* @expectedException \LogicException
*/
public function testToArrayException()
{
$aggregation = new ReverseNestedAggregation('test_agg');
$aggregation->setPath('test_path');
$expectedResult = [
'reverse_nested' => ['path' => 'test_path'],
];
$this->assertEquals($expectedResult, $aggregation->toArray());
}
/**
* Test for reverse_nested aggregation toArray() method exception.
*/
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment