@@ -315,6 +315,8 @@ public function testNextCannotExtractResumeToken()
315
315
$ operation = new Watch ($ this ->manager , $ this ->getDatabaseName (), $ this ->getCollectionName (), $ pipeline , ['maxAwaitTimeMS ' => 100 ]);
316
316
$ changeStream = $ operation ->execute ($ this ->getPrimaryServer ());
317
317
318
+ /* Note: we intentionally do not start iteration with rewind() to ensure
319
+ * that we test extraction functionality within next(). */
318
320
$ this ->insertDocument (['x ' => 1 ]);
319
321
320
322
$ changeStream ->next ();
@@ -379,21 +381,19 @@ public function testMaxAwaitTimeMS()
379
381
$ this ->assertTrue ($ changeStream ->valid ());
380
382
}
381
383
382
- public function testResumeAfterKillThenNoOperations ()
384
+ public function testRewindResumesAfterCursorNotFound ()
383
385
{
384
386
$ operation = new Watch ($ this ->manager , $ this ->getDatabaseName (), $ this ->getCollectionName (), [], ['maxAwaitTimeMS ' => 100 ]);
385
387
$ changeStream = $ operation ->execute ($ this ->getPrimaryServer ());
386
388
387
- $ this ->insertDocument (['_id ' => 1 , 'x ' => 'foo ' ]);
388
-
389
389
$ this ->killChangeStreamCursor ($ changeStream );
390
390
391
391
$ changeStream ->rewind ();
392
392
$ this ->assertFalse ($ changeStream ->valid ());
393
393
$ this ->assertNull ($ changeStream ->current ());
394
394
}
395
395
396
- public function testResumeAfterKillThenOperation ()
396
+ public function testRewindExtractsResumeTokenAndNextResumes ()
397
397
{
398
398
$ operation = new Watch ($ this ->manager , $ this ->getDatabaseName (), $ this ->getCollectionName (), [], ['maxAwaitTimeMS ' => 100 ]);
399
399
$ changeStream = $ operation ->execute ($ this ->getPrimaryServer ());
0 commit comments