@@ -42,6 +42,7 @@ public function testResume()
42
42
$ this ->insertDocument (['_id ' => 2 , 'x ' => 'bar ' ]);
43
43
44
44
$ changeStream ->next ();
45
+ $ this ->assertTrue ($ changeStream ->valid ());
45
46
46
47
$ expectedResult = [
47
48
'_id ' => $ changeStream ->current ()->_id ,
@@ -58,6 +59,7 @@ public function testResume()
58
59
$ this ->insertDocument (['_id ' => 3 , 'x ' => 'baz ' ]);
59
60
60
61
$ changeStream ->next ();
62
+ $ this ->assertTrue ($ changeStream ->valid ());
61
63
62
64
$ expectedResult = [
63
65
'_id ' => $ changeStream ->current ()->_id ,
@@ -139,6 +141,7 @@ public function testNoChangeAfterResumeBeforeInsert()
139
141
$ this ->insertDocument (['_id ' => 2 , 'x ' => 'bar ' ]);
140
142
141
143
$ changeStream ->next ();
144
+ $ this ->assertTrue ($ changeStream ->valid ());
142
145
143
146
$ expectedResult = [
144
147
'_id ' => $ changeStream ->current ()->_id ,
@@ -153,11 +156,13 @@ public function testNoChangeAfterResumeBeforeInsert()
153
156
$ this ->killChangeStreamCursor ($ changeStream );
154
157
155
158
$ changeStream ->next ();
159
+ $ this ->assertFalse ($ changeStream ->valid ());
156
160
$ this ->assertNull ($ changeStream ->current ());
157
161
158
162
$ this ->insertDocument (['_id ' => 3 , 'x ' => 'baz ' ]);
159
163
160
164
$ changeStream ->next ();
165
+ $ this ->assertTrue ($ changeStream ->valid ());
161
166
162
167
$ expectedResult = [
163
168
'_id ' => $ changeStream ->current ()->_id ,
@@ -178,6 +183,7 @@ public function testResumeAfterKillThenNoOperations()
178
183
$ this ->killChangeStreamCursor ($ changeStream );
179
184
180
185
$ changeStream ->next ();
186
+ $ this ->assertFalse ($ changeStream ->valid ());
181
187
$ this ->assertNull ($ changeStream ->current ());
182
188
}
183
189
@@ -191,6 +197,7 @@ public function testResumeAfterKillThenOperation()
191
197
$ this ->insertDocument (['_id ' => 1 , 'x ' => 'foo ' ]);
192
198
193
199
$ changeStream ->next ();
200
+ $ this ->assertFalse ($ changeStream ->valid ());
194
201
$ this ->assertNull ($ changeStream ->current ());
195
202
}
196
203
@@ -204,21 +211,27 @@ public function testKey()
204
211
$ this ->insertDocument (['_id ' => 1 , 'x ' => 'foo ' ]);
205
212
206
213
$ changeStream ->next ();
214
+ $ this ->assertTrue ($ changeStream ->valid ());
207
215
$ this ->assertSame (1 , $ changeStream ->key ());
208
216
209
217
$ changeStream ->next ();
218
+ $ this ->assertFalse ($ changeStream ->valid ());
210
219
$ this ->assertNull ($ changeStream ->key ());
220
+
211
221
$ changeStream ->next ();
222
+ $ this ->assertFalse ($ changeStream ->valid ());
212
223
$ this ->assertNull ($ changeStream ->key ());
213
224
214
225
$ this ->killChangeStreamCursor ($ changeStream );
215
226
216
227
$ changeStream ->next ();
228
+ $ this ->assertFalse ($ changeStream ->valid ());
217
229
$ this ->assertNull ($ changeStream ->key ());
218
230
219
231
$ this ->insertDocument (['_id ' => 2 , 'x ' => 'bar ' ]);
220
232
221
233
$ changeStream ->next ();
234
+ $ this ->assertTrue ($ changeStream ->valid ());
222
235
$ this ->assertSame (2 , $ changeStream ->key ());
223
236
}
224
237
@@ -232,6 +245,7 @@ public function testNonEmptyPipeline()
232
245
$ this ->insertDocument (['_id ' => 1 ]);
233
246
234
247
$ changeStream ->next ();
248
+ $ this ->assertTrue ($ changeStream ->valid ());
235
249
236
250
$ expectedResult = [
237
251
'_id ' => $ changeStream ->current ()->_id ,
0 commit comments