Skip to content

Commit

Permalink
Catch the escaped mutation
Browse files Browse the repository at this point in the history
  • Loading branch information
enrise-mbraam committed Sep 13, 2023
1 parent d29b2d4 commit c3c497f
Showing 1 changed file with 8 additions and 1 deletion.
9 changes: 8 additions & 1 deletion tests/Unit/FinderTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -391,6 +391,7 @@ public function test_it_adds_nested_aggregations(): void
],
],
],
'anotherAggregation' => ['terms' => ['field' => 'anotherField', 'size' => 10]]
],
],
])
Expand All @@ -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);
Expand All @@ -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];

Expand Down

0 comments on commit c3c497f

Please sign in to comment.