@@ -642,7 +642,7 @@ public function testNextAdvancesKey()
642
642
$ this ->assertSame (1 , $ changeStream ->key ());
643
643
}
644
644
645
- public function testResumeTokenNotFoundAdvancesKey ()
645
+ public function testResumeTokenNotFoundDoesNotAdvanceKey ()
646
646
{
647
647
if (version_compare ($ this ->getServerVersion (), '4.1.8 ' , '>= ' )) {
648
648
$ this ->markTestSkipped ('Server rejects change streams that modify resume token (SERVER-37786) ' );
@@ -653,8 +653,6 @@ public function testResumeTokenNotFoundAdvancesKey()
653
653
$ operation = new Watch ($ this ->manager , $ this ->getDatabaseName (), $ this ->getCollectionName (), $ pipeline , $ this ->defaultOptions );
654
654
$ changeStream = $ operation ->execute ($ this ->getPrimaryServer ());
655
655
656
- /* Note: we intentionally do not start iteration with rewind() to ensure
657
- * that we test extraction functionality within next(). */
658
656
$ this ->insertDocument (['x ' => 1 ]);
659
657
$ this ->insertDocument (['x ' => 2 ]);
660
658
$ this ->insertDocument (['x ' => 3 ]);
@@ -671,14 +669,14 @@ public function testResumeTokenNotFoundAdvancesKey()
671
669
$ this ->fail ('ResumeTokenException was not thrown ' );
672
670
} catch (ResumeTokenException $ e ) {}
673
671
674
- $ this ->assertSame (1 , $ changeStream ->key ());
672
+ $ this ->assertSame (0 , $ changeStream ->key ());
675
673
676
674
try {
677
675
$ changeStream ->next ();
678
676
$ this ->fail ('ResumeTokenException was not thrown ' );
679
677
} catch (ResumeTokenException $ e ) {}
680
678
681
- $ this ->assertSame (2 , $ changeStream ->key ());
679
+ $ this ->assertSame (0 , $ changeStream ->key ());
682
680
}
683
681
684
682
public function testSessionPersistsAfterResume ()
0 commit comments