@@ -60,7 +60,7 @@ public function setUp(): void
60
60
*/
61
61
public function testGetResumeToken (): void
62
62
{
63
- $ this ->skipIfPostBatchResumeTokenNotSupported ( );
63
+ $ this ->skipIfServerVersion ( ' >= ' , ' 4.0.7 ' , ' postBatchResumeToken is supported ' );
64
64
65
65
$ operation = new Watch ($ this ->manager , $ this ->getDatabaseName (), $ this ->getCollectionName (), [], $ this ->defaultOptions );
66
66
$ changeStream = $ operation ->execute ($ this ->getPrimaryServer ());
@@ -105,7 +105,7 @@ public function testGetResumeToken(): void
105
105
*/
106
106
public function testGetResumeTokenWithPostBatchResumeToken (): void
107
107
{
108
- $ this ->markTestSkipped ( 'postBatchResumeToken is not supported ' );
108
+ $ this ->skipIfServerVersion ( ' < ' , ' 4.0.7 ' , 'postBatchResumeToken is not supported ' );
109
109
110
110
$ operation = new Watch ($ this ->manager , $ this ->getDatabaseName (), $ this ->getCollectionName (), [], $ this ->defaultOptions );
111
111
@@ -201,7 +201,7 @@ function (array $event) use (&$commands): void {
201
201
202
202
public function testResumeBeforeReceivingAnyResultsIncludesPostBatchResumeToken (): void
203
203
{
204
- $ this ->markTestSkipped ( 'postBatchResumeToken is not supported ' );
204
+ $ this ->skipIfServerVersion ( ' < ' , ' 4.0.7 ' , 'postBatchResumeToken is not supported ' );
205
205
206
206
$ operation = new Watch ($ this ->manager , $ this ->getDatabaseName (), $ this ->getCollectionName (), [], $ this ->defaultOptions );
207
207
@@ -275,8 +275,7 @@ public function testResumeBeforeReceivingAnyResultsIncludesStartAtOperationTime(
275
275
$ this ->markTestSkipped ('startAtOperationTime is not supported ' );
276
276
}
277
277
278
- // postBatchResumeToken takes precedence over startAtOperationTime
279
- $ this ->skipIfPostBatchResumeTokenNotSupported ();
278
+ $ this ->skipIfServerVersion ('>= ' , '4.0.7 ' , 'postBatchResumeToken takes precedence over startAtOperationTime ' );
280
279
281
280
$ operation = new Watch ($ this ->manager , $ this ->getDatabaseName (), $ this ->getCollectionName (), [], $ this ->defaultOptions );
282
281
@@ -691,7 +690,7 @@ public function testInitialCursorIsNotClosed(): void
691
690
*/
692
691
public function testResumeTokenNotFoundClientSideError (): void
693
692
{
694
- $ this ->skipIfServerVersionNotSupported ('>= ' , '4.1.8 ' , 'Server rejects change streams that modify resume token (SERVER-37786) ' );
693
+ $ this ->skipIfServerVersion ('>= ' , '4.1.8 ' , 'Server rejects change streams that modify resume token (SERVER-37786) ' );
695
694
696
695
$ pipeline = [['$project ' => ['_id ' => 0 ]]];
697
696
@@ -717,7 +716,7 @@ public function testResumeTokenNotFoundClientSideError(): void
717
716
*/
718
717
public function testResumeTokenNotFoundServerSideError (): void
719
718
{
720
- $ this ->skipIfServerVersionNotSupported ('< ' , '4.1.8 ' , 'Server does not reject change streams that modify resume token ' );
719
+ $ this ->skipIfServerVersion ('< ' , '4.1.8 ' , 'Server does not reject change streams that modify resume token ' );
721
720
722
721
$ pipeline = [['$project ' => ['_id ' => 0 ]]];
723
722
@@ -738,7 +737,7 @@ public function testResumeTokenNotFoundServerSideError(): void
738
737
*/
739
738
public function testResumeTokenInvalidTypeClientSideError (): void
740
739
{
741
- $ this ->skipIfServerVersionNotSupported ('>= ' , '4.1.8 ' , 'Server rejects change streams that modify resume token (SERVER-37786) ' );
740
+ $ this ->skipIfServerVersion ('>= ' , '4.1.8 ' , 'Server rejects change streams that modify resume token (SERVER-37786) ' );
742
741
743
742
$ pipeline = [['$project ' => ['_id ' => ['$literal ' => 'foo ' ]]]];
744
743
@@ -764,7 +763,7 @@ public function testResumeTokenInvalidTypeClientSideError(): void
764
763
*/
765
764
public function testResumeTokenInvalidTypeServerSideError (): void
766
765
{
767
- $ this ->skipIfServerVersionNotSupported ('< ' , '4.1.8 ' , 'Server does not reject change streams that modify resume token ' );
766
+ $ this ->skipIfServerVersion ('< ' , '4.1.8 ' , 'Server does not reject change streams that modify resume token ' );
768
767
769
768
$ pipeline = [['$project ' => ['_id ' => ['$literal ' => 'foo ' ]]]];
770
769
@@ -948,7 +947,7 @@ public function testResumeAfterOption(): void
948
947
949
948
public function testStartAfterOption (): void
950
949
{
951
- $ this ->skipIfServerVersionNotSupported ('< ' , '4.1.1 ' , 'startAfter is not supported ' );
950
+ $ this ->skipIfServerVersion ('< ' , '4.1.1 ' , 'startAfter is not supported ' );
952
951
953
952
$ operation = new Watch ($ this ->manager , $ this ->getDatabaseName (), $ this ->getCollectionName (), [], $ this ->defaultOptions );
954
953
$ changeStream = $ operation ->execute ($ this ->getPrimaryServer ());
@@ -1158,7 +1157,7 @@ function (array $event) use (&$sessionAfterResume, &$commands): void {
1158
1157
public function testSessionFreed (): void
1159
1158
{
1160
1159
if ($ this ->isShardedCluster ()) {
1161
- $ this ->skipIfServerVersionNotSupported ('>= ' , '5.1.0 ' , 'mongos still reports non-zero cursor ID for invalidated change stream (SERVER-60764) ' );
1160
+ $ this ->skipIfServerVersion ('>= ' , '5.1.0 ' , 'mongos still reports non-zero cursor ID for invalidated change stream (SERVER-60764) ' );
1162
1161
}
1163
1162
1164
1163
$ operation = new Watch ($ this ->manager , $ this ->getDatabaseName (), $ this ->getCollectionName (), [], $ this ->defaultOptions );
@@ -1265,7 +1264,7 @@ function (array $aggregateCommand) {
1265
1264
*/
1266
1265
public function testErrorDuringAggregateCommandDoesNotCauseResume (): void
1267
1266
{
1268
- $ this ->skipIfServerVersionNotSupported ('< ' , '4.0.0 ' , 'failCommand is not supported ' );
1267
+ $ this ->skipIfServerVersion ('< ' , '4.0.0 ' , 'failCommand is not supported ' );
1269
1268
1270
1269
$ operation = new Watch ($ this ->manager , $ this ->getDatabaseName (), $ this ->getCollectionName (), [], $ this ->defaultOptions );
1271
1270
@@ -1342,7 +1341,7 @@ function () {
1342
1341
*/
1343
1342
public function testGetResumeTokenReturnsOriginalResumeTokenOnEmptyBatch (): void
1344
1343
{
1345
- $ this ->skipIfPostBatchResumeTokenNotSupported ( );
1344
+ $ this ->skipIfServerVersion ( ' >= ' , ' 4.0.7 ' , ' postBatchResumeToken is supported ' );
1346
1345
1347
1346
$ operation = new Watch ($ this ->manager , $ this ->getDatabaseName (), $ this ->getCollectionName (), [], $ this ->defaultOptions );
1348
1347
$ changeStream = $ operation ->execute ($ this ->getPrimaryServer ());
@@ -1376,7 +1375,7 @@ public function testGetResumeTokenReturnsOriginalResumeTokenOnEmptyBatch(): void
1376
1375
*/
1377
1376
public function testResumeTokenBehaviour (): void
1378
1377
{
1379
- $ this ->skipIfServerVersionNotSupported ('< ' , '4.1.1 ' , 'Testing resumeAfter and startAfter can only be tested on servers >= 4.1.1 ' );
1378
+ $ this ->skipIfServerVersion ('< ' , '4.1.1 ' , 'Testing resumeAfter and startAfter can only be tested on servers >= 4.1.1 ' );
1380
1379
$ this ->skipIfIsShardedCluster ('Resume token behaviour can \'t be reliably tested on sharded clusters. ' );
1381
1380
1382
1381
$ operation = new Watch ($ this ->manager , $ this ->getDatabaseName (), $ this ->getCollectionName (), [], $ this ->defaultOptions );
@@ -1432,7 +1431,7 @@ public function testResumeTokenBehaviour(): void
1432
1431
*/
1433
1432
public function testResumingChangeStreamWithoutPreviousResultsIncludesStartAfterOption (): void
1434
1433
{
1435
- $ this ->skipIfServerVersionNotSupported ('< ' , '4.1.1 ' , 'Testing resumeAfter and startAfter can only be tested on servers >= 4.1.1 ' );
1434
+ $ this ->skipIfServerVersion ('< ' , '4.1.1 ' , 'Testing resumeAfter and startAfter can only be tested on servers >= 4.1.1 ' );
1436
1435
1437
1436
$ operation = new Watch ($ this ->manager , $ this ->getDatabaseName (), $ this ->getCollectionName (), [], $ this ->defaultOptions );
1438
1437
$ changeStream = $ operation ->execute ($ this ->getPrimaryServer ());
@@ -1477,7 +1476,7 @@ function (array $event) use (&$aggregateCommand): void {
1477
1476
*/
1478
1477
public function testResumingChangeStreamWithPreviousResultsIncludesResumeAfterOption (): void
1479
1478
{
1480
- $ this ->skipIfServerVersionNotSupported ('< ' , '4.1.1 ' , 'Testing resumeAfter and startAfter can only be tested on servers >= 4.1.1 ' );
1479
+ $ this ->skipIfServerVersion ('< ' , '4.1.1 ' , 'Testing resumeAfter and startAfter can only be tested on servers >= 4.1.1 ' );
1481
1480
1482
1481
$ operation = new Watch ($ this ->manager , $ this ->getDatabaseName (), $ this ->getCollectionName (), [], $ this ->defaultOptions );
1483
1482
$ changeStream = $ operation ->execute ($ this ->getPrimaryServer ());
@@ -1567,11 +1566,6 @@ private function insertDocument($document): void
1567
1566
$ this ->assertEquals (1 , $ writeResult ->getInsertedCount ());
1568
1567
}
1569
1568
1570
- private function skipIfPostBatchResumeTokenNotSupported (): void
1571
- {
1572
- $ this ->skipIfServerVersionNotSupported ('>= ' , '4.0.7 ' , 'postBatchResumeToken is supported ' );
1573
- }
1574
-
1575
1569
private function isStartAtOperationTimeSupported ()
1576
1570
{
1577
1571
return server_supports_feature ($ this ->getPrimaryServer (), self ::$ wireVersionForStartAtOperationTime );
0 commit comments