@@ -341,7 +341,7 @@ public function testAggregate(): void
341
341
$ explainOperation = new Explain ($ this ->getDatabaseName (), $ operation , ['verbosity ' => Explain::VERBOSITY_QUERY , 'typeMap ' => ['root ' => 'array ' , 'document ' => 'array ' ]]);
342
342
$ result = $ explainOperation ->execute ($ this ->getPrimaryServer ());
343
343
344
- $ this ->assertExplainResult ($ result , false , false , true );
344
+ $ this ->assertExplainResult ($ result , false , false );
345
345
}
346
346
347
347
/** @dataProvider provideVerbosityInformation */
@@ -369,7 +369,7 @@ public function provideVerbosityInformation()
369
369
];
370
370
}
371
371
372
- private function assertExplainResult ($ result , $ executionStatsExpected , $ allPlansExecutionExpected, $ stagesExpected = false ): void
372
+ private function assertExplainResult ($ result , $ executionStatsExpected , $ allPlansExecutionExpected ): void
373
373
{
374
374
$ checkResult = $ result ;
375
375
@@ -378,11 +378,10 @@ private function assertExplainResult($result, $executionStatsExpected, $allPlans
378
378
$ checkResult = $ result ['shards ' ][$ firstShard ];
379
379
}
380
380
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
+ ));
386
385
387
386
if ($ executionStatsExpected ) {
388
387
$ this ->assertArrayHasKey ('executionStats ' , $ checkResult );
0 commit comments