From 9ce60d5c49fd82dc3ef06c4c4ecfe64e4b3f35ec Mon Sep 17 00:00:00 2001 From: Mantas <marc.mantas@gmail.com> Date: Mon, 14 Mar 2016 15:27:36 +0200 Subject: [PATCH] removed the exception from nestedAggregation when not containing any aggregations --- src/Aggregation/NestedAggregation.php | 4 ---- tests/Aggregation/NestedAggregationTest.php | 12 ------------ 2 files changed, 16 deletions(-) diff --git a/src/Aggregation/NestedAggregation.php b/src/Aggregation/NestedAggregation.php index f3ace96..be5da0b 100644 --- a/src/Aggregation/NestedAggregation.php +++ b/src/Aggregation/NestedAggregation.php @@ -71,10 +71,6 @@ class NestedAggregation extends AbstractAggregation */ public function getArray() { - if (count($this->getAggregations()) == 0) { - throw new \LogicException("Nested aggregation `{$this->getName()}` has no aggregations added"); - } - return ['path' => $this->getPath()]; } } diff --git a/tests/Aggregation/NestedAggregationTest.php b/tests/Aggregation/NestedAggregationTest.php index 437823f..874c299 100644 --- a/tests/Aggregation/NestedAggregationTest.php +++ b/tests/Aggregation/NestedAggregationTest.php @@ -16,18 +16,6 @@ use ONGR\ElasticsearchDSL\Aggregation\TermsAggregation; class NestedAggregationTest extends \PHPUnit_Framework_TestCase { - /** - * Test for nested aggregation toArray() method exception. - * - * @expectedException \LogicException - */ - public function testToArrayException() - { - $aggregation = new NestedAggregation('test_agg'); - $aggregation->setPath('test_path'); - $aggregation->toArray(); - } - /** * Test for nested aggregation toArray() method exception. */ -- GitLab