@@ -315,6 +315,8 @@ public function testNextCannotExtractResumeToken()
315315 $ operation = new Watch ($ this ->manager , $ this ->getDatabaseName (), $ this ->getCollectionName (), $ pipeline , ['maxAwaitTimeMS ' => 100 ]);
316316 $ changeStream = $ operation ->execute ($ this ->getPrimaryServer ());
317317
318+ /* Note: we intentionally do not start iteration with rewind() to ensure
319+ * that we test extraction functionality within next(). */
318320 $ this ->insertDocument (['x ' => 1 ]);
319321
320322 $ changeStream ->next ();
@@ -379,21 +381,19 @@ public function testMaxAwaitTimeMS()
379381 $ this ->assertTrue ($ changeStream ->valid ());
380382 }
381383
382- public function testResumeAfterKillThenNoOperations ()
384+ public function testRewindResumesAfterCursorNotFound ()
383385 {
384386 $ operation = new Watch ($ this ->manager , $ this ->getDatabaseName (), $ this ->getCollectionName (), [], ['maxAwaitTimeMS ' => 100 ]);
385387 $ changeStream = $ operation ->execute ($ this ->getPrimaryServer ());
386388
387- $ this ->insertDocument (['_id ' => 1 , 'x ' => 'foo ' ]);
388-
389389 $ this ->killChangeStreamCursor ($ changeStream );
390390
391391 $ changeStream ->rewind ();
392392 $ this ->assertFalse ($ changeStream ->valid ());
393393 $ this ->assertNull ($ changeStream ->current ());
394394 }
395395
396- public function testResumeAfterKillThenOperation ()
396+ public function testRewindExtractsResumeTokenAndNextResumes ()
397397 {
398398 $ operation = new Watch ($ this ->manager , $ this ->getDatabaseName (), $ this ->getCollectionName (), [], ['maxAwaitTimeMS ' => 100 ]);
399399 $ changeStream = $ operation ->execute ($ this ->getPrimaryServer ());
0 commit comments