@@ -41,29 +41,33 @@ public function testResume()
41
41
$ this ->insertDocument (['_id ' => 2 , 'x ' => 'bar ' ]);
42
42
43
43
$ changeStream ->next ();
44
- $ expectedResult = (object ) ([
45
- '_id ' => $ changeStream ->current ()->_id ,
46
- 'operationType ' => 'insert ' ,
47
- 'fullDocument ' => (object ) ['_id ' => 2 , 'x ' => 'bar ' ],
48
- 'ns ' => (object ) ['db ' => 'phplib_test ' , 'coll ' => 'WatchFunctionalTest.e68b9f01 ' ],
49
- 'documentKey ' => (object ) ['_id ' => 2 ]
50
- ]);
51
- $ this ->assertEquals ($ expectedResult , $ changeStream ->current ());
44
+
45
+ $ expectedResult = [
46
+ '_id ' => $ changeStream ->current ()->_id ,
47
+ 'operationType ' => 'insert ' ,
48
+ 'fullDocument ' => ['_id ' => 2 , 'x ' => 'bar ' ],
49
+ 'ns ' => ['db ' => $ this ->getDatabaseName (), 'coll ' => $ this ->getCollectionName ()],
50
+ 'documentKey ' => ['_id ' => 2 ],
51
+ ];
52
+
53
+ $ this ->assertSameDocument ($ expectedResult , $ changeStream ->current ());
52
54
53
55
$ operation = new DatabaseCommand ($ this ->getDatabaseName (), ["killCursors " => $ this ->getCollectionName (), "cursors " => [$ changeStream ->getCursorId ()]]);
54
56
$ operation ->execute ($ this ->getPrimaryServer ());
55
57
56
58
$ this ->insertDocument (['_id ' => 3 , 'x ' => 'baz ' ]);
57
59
58
60
$ changeStream ->next ();
59
- $ expectedResult = (object ) ([
60
- '_id ' => $ changeStream ->current ()->_id ,
61
- 'operationType ' => 'insert ' ,
62
- 'fullDocument ' => (object ) ['_id ' => 3 , 'x ' => 'baz ' ],
63
- 'ns ' => (object ) ['db ' => 'phplib_test ' , 'coll ' => 'WatchFunctionalTest.e68b9f01 ' ],
64
- 'documentKey ' => (object ) ['_id ' => 3 ]
65
- ]);
66
- $ this ->assertEquals ($ expectedResult , $ changeStream ->current ());
61
+
62
+ $ expectedResult = [
63
+ '_id ' => $ changeStream ->current ()->_id ,
64
+ 'operationType ' => 'insert ' ,
65
+ 'fullDocument ' => ['_id ' => 3 , 'x ' => 'baz ' ],
66
+ 'ns ' => ['db ' => $ this ->getDatabaseName (), 'coll ' => $ this ->getCollectionName ()],
67
+ 'documentKey ' => ['_id ' => 3 ]
68
+ ];
69
+
70
+ $ this ->assertSameDocument ($ expectedResult , $ changeStream ->current ());
67
71
}
68
72
69
73
/**
@@ -135,14 +139,16 @@ public function testNoChangeAfterResumeBeforeInsert()
135
139
$ this ->insertDocument (['_id ' => 2 , 'x ' => 'bar ' ]);
136
140
137
141
$ changeStream ->next ();
138
- $ expectedResult = (object ) ([
139
- '_id ' => $ changeStream ->current ()->_id ,
140
- 'operationType ' => 'insert ' ,
141
- 'fullDocument ' => (object ) ['_id ' => 2 , 'x ' => 'bar ' ],
142
- 'ns ' => (object ) ['db ' => 'phplib_test ' , 'coll ' => 'WatchFunctionalTest.4a554985 ' ],
143
- 'documentKey ' => (object ) ['_id ' => 2 ]
144
- ]);
145
- $ this ->assertEquals ($ expectedResult , $ changeStream ->current ());
142
+
143
+ $ expectedResult = [
144
+ '_id ' => $ changeStream ->current ()->_id ,
145
+ 'operationType ' => 'insert ' ,
146
+ 'fullDocument ' => ['_id ' => 2 , 'x ' => 'bar ' ],
147
+ 'ns ' => ['db ' => $ this ->getDatabaseName (), 'coll ' => $ this ->getCollectionName ()],
148
+ 'documentKey ' => ['_id ' => 2 ],
149
+ ];
150
+
151
+ $ this ->assertSameDocument ($ expectedResult , $ changeStream ->current ());
146
152
147
153
$ operation = new DatabaseCommand ($ this ->getDatabaseName (), ["killCursors " => $ this ->getCollectionName (), "cursors " => [$ changeStream ->getCursorId ()]]);
148
154
$ operation ->execute ($ this ->getPrimaryServer ());
@@ -153,14 +159,16 @@ public function testNoChangeAfterResumeBeforeInsert()
153
159
$ this ->insertDocument (['_id ' => 3 , 'x ' => 'baz ' ]);
154
160
155
161
$ changeStream ->next ();
156
- $ expectedResult = (object ) ([
157
- '_id ' => $ changeStream ->current ()->_id ,
158
- 'operationType ' => 'insert ' ,
159
- 'fullDocument ' => (object ) ['_id ' => 3 , 'x ' => 'baz ' ],
160
- 'ns ' => (object ) ['db ' => 'phplib_test ' , 'coll ' => 'WatchFunctionalTest.4a554985 ' ],
161
- 'documentKey ' => (object ) ['_id ' => 3 ]
162
- ]);
163
- $ this ->assertEquals ($ expectedResult , $ changeStream ->current ());
162
+
163
+ $ expectedResult = [
164
+ '_id ' => $ changeStream ->current ()->_id ,
165
+ 'operationType ' => 'insert ' ,
166
+ 'fullDocument ' => ['_id ' => 3 , 'x ' => 'baz ' ],
167
+ 'ns ' => ['db ' => $ this ->getDatabaseName (), 'coll ' => $ this ->getCollectionName ()],
168
+ 'documentKey ' => ['_id ' => 3 ],
169
+ ];
170
+
171
+ $ this ->assertSameDocument ($ expectedResult , $ changeStream ->current ());
164
172
}
165
173
166
174
public function testResumeAfterKillThenNoOperations ()
@@ -228,11 +236,13 @@ public function testNonEmptyPipeline()
228
236
$ this ->insertDocument (['_id ' => 1 ]);
229
237
230
238
$ changeStream ->next ();
231
- $ expectedResult = (object ) ([
232
- '_id ' => $ changeStream ->current ()->_id ,
233
- 'foo ' => [0 ]
234
- ]);
235
- $ this ->assertEquals ($ expectedResult , $ changeStream ->current ());
239
+
240
+ $ expectedResult = [
241
+ '_id ' => $ changeStream ->current ()->_id ,
242
+ 'foo ' => [0 ],
243
+ ];
244
+
245
+ $ this ->assertSameDocument ($ expectedResult , $ changeStream ->current ());
236
246
}
237
247
238
248
public function testCursorWithEmptyBatchNotClosed ()
0 commit comments