Skip to content

Commit ae2b853

Browse files
committed
Demonstrate edge case where replacement doc encodes as pipeline array
1 parent 142411c commit ae2b853

File tree

1 file changed

+13
-0
lines changed

1 file changed

+13
-0
lines changed

tests/Operation/UpdateFunctionalTest.php

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -52,6 +52,7 @@ function (array $event) use ($expectedFilter): void {
5252
* @dataProvider provideReplacementDocuments
5353
* @dataProvider provideUpdateDocuments
5454
* @dataProvider provideUpdatePipelines
55+
* @dataProvider provideReplacementDocumentLikePipeline
5556
*/
5657
public function testUpdateDocuments($update, $expectedUpdate): void
5758
{
@@ -76,6 +77,18 @@ function (array $event) use ($expectedUpdate): void {
7677
);
7778
}
7879

80+
public function provideReplacementDocumentLikePipeline(): array
81+
{
82+
/* libmongoc encodes this replacement document as a BSON array because
83+
* it resembles an update pipeline (see: CDRIVER-4658). */
84+
return [
85+
'replacement_like_pipeline' => [
86+
(object) ['0' => ['$set' => ['x' => 1]]],
87+
[(object) ['$set' => (object) ['x' => 1]]],
88+
],
89+
];
90+
}
91+
7992
public function testSessionOption(): void
8093
{
8194
(new CommandObserver())->observe(

0 commit comments

Comments
 (0)