From c3c497f17058e3022138e3c92c7ce90177b45606 Mon Sep 17 00:00:00 2001 From: Menno Braam Date: Wed, 13 Sep 2023 12:42:50 +0200 Subject: [PATCH] Catch the escaped mutation --- tests/Unit/FinderTest.php | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) diff --git a/tests/Unit/FinderTest.php b/tests/Unit/FinderTest.php index c12ca50..c0f96ee 100644 --- a/tests/Unit/FinderTest.php +++ b/tests/Unit/FinderTest.php @@ -391,6 +391,7 @@ public function test_it_adds_nested_aggregations(): void ], ], ], + 'anotherAggregation' => ['terms' => ['field' => 'anotherField', 'size' => 10]] ], ], ]) @@ -410,10 +411,16 @@ public function test_it_adds_nested_aggregations(): void ], ], ], + 'specificAggregation' => [ + 'buckets' => [ + ['key' => 'myKey', 'doc_count' => 42] + ] + ], ], ]); $query = Query::with(new BoolQuery()); + $query->addAggregation('anotherAggregation', new TermsAggregation('anotherField')); $nestedAggregation = new NestedAggregation('nestedAggregation'); $nestedAggregation->add('someField', new TermsAggregation('nestedAggregation.someField')); $query->addAggregation('nestedAggregation',$nestedAggregation); @@ -423,7 +430,7 @@ public function test_it_adds_nested_aggregations(): void $subject = new Finder($client, $builder); $results = $subject->find(); - self::assertCount(1, $results->aggregations()); + self::assertCount(2, $results->aggregations()); $nestedAggregation = $results->aggregations()[0];