@@ -341,7 +341,7 @@ public function testAggregate(): void
341341 $ explainOperation = new Explain ($ this ->getDatabaseName (), $ operation , ['verbosity ' => Explain::VERBOSITY_QUERY , 'typeMap ' => ['root ' => 'array ' , 'document ' => 'array ' ]]);
342342 $ result = $ explainOperation ->execute ($ this ->getPrimaryServer ());
343343
344- $ this ->assertExplainResult ($ result , false , false , true );
344+ $ this ->assertExplainResult ($ result , false , false );
345345 }
346346
347347 /** @dataProvider provideVerbosityInformation */
@@ -369,7 +369,7 @@ public function provideVerbosityInformation()
369369 ];
370370 }
371371
372- private function assertExplainResult ($ result , $ executionStatsExpected , $ allPlansExecutionExpected, $ stagesExpected = false ): void
372+ private function assertExplainResult ($ result , $ executionStatsExpected , $ allPlansExecutionExpected ): void
373373 {
374374 $ checkResult = $ result ;
375375
@@ -378,11 +378,10 @@ private function assertExplainResult($result, $executionStatsExpected, $allPlans
378378 $ checkResult = $ result ['shards ' ][$ firstShard ];
379379 }
380380
381- if ($ stagesExpected ) {
382- $ this ->assertArrayHasKey ('stages ' , $ checkResult );
383- } else {
384- $ this ->assertArrayHasKey ('queryPlanner ' , $ checkResult );
385- }
381+ $ this ->assertThat ($ checkResult , $ this ->logicalOr (
382+ $ this ->arrayHasKey ('stages ' ),
383+ $ this ->arrayHasKey ('queryPlanner ' ),
384+ ));
386385
387386 if ($ executionStatsExpected ) {
388387 $ this ->assertArrayHasKey ('executionStats ' , $ checkResult );
0 commit comments