Skip to content

Commit a928500

Browse files
committed
PHPLIB-431: Relax aggregate explain test for 4.2 servers
1 parent d5ce656 commit a928500

File tree

1 file changed

+7
-1
lines changed

1 file changed

+7
-1
lines changed

tests/Operation/AggregateFunctionalTest.php

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -190,7 +190,13 @@ public function testExplainOption()
190190
$results = iterator_to_array($operation->execute($this->getPrimaryServer()));
191191

192192
$this->assertCount(1, $results);
193-
$this->assertArrayHasKey('stages', $results[0]);
193+
194+
/* MongoDB 4.2 may optimize aggregate pipelines into queries, which can
195+
* result in different explain output (see: SERVER-24860) */
196+
$this->assertThat($results[0], $this->logicalOr(
197+
$this->arrayHasKey('stages'),
198+
$this->arrayHasKey('queryPlanner')
199+
));
194200
}
195201

196202
public function testExplainOptionWithWriteConcern()

0 commit comments

Comments
 (0)