Skip to content

Commit 5f77d13

Browse files
committed
PHPLIB-457: Add prose test numbers in WatchFunctionalTest
1 parent 7408bf4 commit 5f77d13

File tree

1 file changed

+49
-33
lines changed

1 file changed

+49
-33
lines changed

tests/Operation/WatchFunctionalTest.php

Lines changed: 49 additions & 33 deletions
Original file line numberDiff line numberDiff line change
@@ -52,7 +52,7 @@ private function doSetUp()
5252
}
5353

5454
/**
55-
* Prose test: "ChangeStream must continuously track the last seen
55+
* Prose test 1: "ChangeStream must continuously track the last seen
5656
* resumeToken"
5757
*/
5858
public function testGetResumeToken()
@@ -87,8 +87,22 @@ public function testGetResumeToken()
8787
}
8888

8989
/**
90-
* Prose test: "ChangeStream must continuously track the last seen
90+
* Prose test 1: "ChangeStream must continuously track the last seen
9191
* resumeToken"
92+
*
93+
* Prose test 11:
94+
* For a ChangeStream under these conditions:
95+
* - Running against a server >=4.0.7.
96+
* - The batch is empty or has been iterated to the last document.
97+
* Expected result: getResumeToken must return the postBatchResumeToken from
98+
* the current command response.
99+
*
100+
* Prose test 13:
101+
* For a ChangeStream under these conditions:
102+
* - The batch is not empty.
103+
* - The batch has been iterated up to but not including the last element.
104+
* Expected result: getResumeToken must return the _id of the previous
105+
* document returned.
92106
*/
93107
public function testGetResumeTokenWithPostBatchResumeToken()
94108
{
@@ -144,7 +158,7 @@ function (array $event) use (&$events) {
144158
}
145159

146160
/**
147-
* Prose test: "ChangeStream will resume after a killCursors command is
161+
* Prose test 10: "ChangeStream will resume after a killCursors command is
148162
* issued for its child cursor."
149163
*/
150164
public function testNextResumesAfterCursorNotFound()
@@ -301,8 +315,8 @@ private function assertResumeAfter($expectedResumeToken, stdClass $command)
301315
}
302316

303317
/**
304-
* Prose test: "$changeStream stage for ChangeStream against a server >=4.0
305-
* and <4.0.7 that has not received any results yet MUST include a
318+
* Prose test 9: "$changeStream stage for ChangeStream against a server
319+
* >=4.0 and <4.0.7 that has not received any results yet MUST include a
306320
* startAtOperationTime option when resuming a changestream."
307321
*/
308322
public function testResumeBeforeReceivingAnyResultsIncludesStartAtOperationTime()
@@ -691,8 +705,9 @@ public function testNonEmptyPipeline()
691705
}
692706

693707
/**
694-
* Prose test: "Ensure that a cursor returned from an aggregate command with
695-
* a cursor id and an initial empty batch is not closed on the driver side."
708+
* Prose test 7: "Ensure that a cursor returned from an aggregate command
709+
* with a cursor id and an initial empty batch is not closed on the driver
710+
* side."
696711
*/
697712
public function testInitialCursorIsNotClosed()
698713
{
@@ -722,7 +737,7 @@ public function testInitialCursorIsNotClosed()
722737
}
723738

724739
/**
725-
* Prose test: "ChangeStream will not attempt to resume after encountering
740+
* Prose test 5: "ChangeStream will not attempt to resume after encountering
726741
* error code 11601 (Interrupted), 136 (CappedPositionLost), or 237
727742
* (CursorKilled) while executing a getMore command."
728743
*
@@ -757,9 +772,9 @@ public function provideNonResumableErrorCodes()
757772
}
758773

759774
/**
760-
* Prose test: "ChangeStream will throw an exception if the server response
761-
* is missing the resume token (if wire version is < 8, this is a driver-
762-
* side error; for 8+, this is a server-side error)"
775+
* Prose test 2: "ChangeStream will throw an exception if the server
776+
* response is missing the resume token (if wire version is < 8, this is a
777+
* driver-side error; for 8+, this is a server-side error)"
763778
*/
764779
public function testResumeTokenNotFoundClientSideError()
765780
{
@@ -785,9 +800,9 @@ public function testResumeTokenNotFoundClientSideError()
785800
}
786801

787802
/**
788-
* Prose test: "ChangeStream will throw an exception if the server response
789-
* is missing the resume token (if wire version is < 8, this is a driver-
790-
* side error; for 8+, this is a server-side error)"
803+
* Prose test 2: "ChangeStream will throw an exception if the server
804+
* response is missing the resume token (if wire version is < 8, this is a
805+
* driver-side error; for 8+, this is a server-side error)"
791806
*/
792807
public function testResumeTokenNotFoundServerSideError()
793808
{
@@ -808,9 +823,9 @@ public function testResumeTokenNotFoundServerSideError()
808823
}
809824

810825
/**
811-
* Prose test: "ChangeStream will throw an exception if the server response
812-
* is missing the resume token (if wire version is < 8, this is a driver-
813-
* side error; for 8+, this is a server-side error)"
826+
* Prose test 2: "ChangeStream will throw an exception if the server
827+
* response is missing the resume token (if wire version is < 8, this is a
828+
* driver-side error; for 8+, this is a server-side error)"
814829
*/
815830
public function testResumeTokenInvalidTypeClientSideError()
816831
{
@@ -836,9 +851,9 @@ public function testResumeTokenInvalidTypeClientSideError()
836851
}
837852

838853
/**
839-
* Prose test: "ChangeStream will throw an exception if the server response
840-
* is missing the resume token (if wire version is < 8, this is a driver-
841-
* side error; for 8+, this is a server-side error)"
854+
* Prose test 2: "ChangeStream will throw an exception if the server
855+
* response is missing the resume token (if wire version is < 8, this is a
856+
* driver-side error; for 8+, this is a server-side error)"
842857
*/
843858
public function testResumeTokenInvalidTypeServerSideError()
844859
{
@@ -1225,7 +1240,7 @@ public function testSessionFreed()
12251240
}
12261241

12271242
/**
1228-
* Prose test: "ChangeStream will automatically resume one time on a
1243+
* Prose test 3: "ChangeStream will automatically resume one time on a
12291244
* resumable error (including not master) with the initial pipeline and
12301245
* options, except for the addition/update of a resumeToken."
12311246
*/
@@ -1302,7 +1317,7 @@ function (array $aggregateCommand) {
13021317
}
13031318

13041319
/**
1305-
* Prose test: "ChangeStream will not attempt to resume on any error
1320+
* Prose test 4: "ChangeStream will not attempt to resume on any error
13061321
* encountered while executing an aggregate command."
13071322
*/
13081323
public function testErrorDuringAggregateCommandDoesNotCauseResume()
@@ -1336,8 +1351,8 @@ function (array $event) use (&$commandCount) {
13361351
}
13371352

13381353
/**
1339-
* Prose test: "ChangeStream will perform server selection before attempting
1340-
* to resume, using initial readPreference"
1354+
* Prose test 6: "ChangeStream will perform server selection before
1355+
* attempting to resume, using initial readPreference"
13411356
*/
13421357
public function testOriginalReadPreferenceIsPreservedOnResume()
13431358
{
@@ -1371,7 +1386,7 @@ function () {
13711386
}
13721387

13731388
/**
1374-
* Prose test
1389+
* Prose test 12
13751390
* For a ChangeStream under these conditions:
13761391
* - Running against a server <4.0.7.
13771392
* - The batch is empty or has been iterated to the last document.
@@ -1406,6 +1421,7 @@ public function testGetResumeTokenReturnsOriginalResumeTokenOnEmptyBatch()
14061421
}
14071422

14081423
/**
1424+
* Prose test 14
14091425
* For a ChangeStream under these conditions:
14101426
* - The batch is not empty.
14111427
* - The batch hasn’t been iterated at all.
@@ -1467,10 +1483,10 @@ public function testResumeTokenBehaviour()
14671483
}
14681484

14691485
/**
1470-
* Prose test: "$changeStream stage for ChangeStream started with startAfter
1471-
* against a server >=4.1.1 that has not received any results yet MUST
1472-
* include a startAfter option and MUST NOT include a resumeAfter option
1473-
* when resuming a change stream."
1486+
* Prose test 17: "$changeStream stage for ChangeStream started with
1487+
* startAfter against a server >=4.1.1 that has not received any results yet
1488+
* MUST include a startAfter option and MUST NOT include a resumeAfter
1489+
* option when resuming a change stream."
14741490
*/
14751491
public function testResumingChangeStreamWithoutPreviousResultsIncludesStartAfterOption()
14761492
{
@@ -1514,10 +1530,10 @@ function (array $event) use (&$aggregateCommand) {
15141530
}
15151531

15161532
/**
1517-
* Prose test: "$changeStream stage for ChangeStream started with startAfter
1518-
* against a server >=4.1.1 that has received at least one result MUST
1519-
* include a resumeAfter option and MUST NOT include a startAfter option
1520-
* when resuming a change stream."
1533+
* Prose test 18: "$changeStream stage for ChangeStream started with
1534+
* startAfter against a server >=4.1.1 that has received at least one result
1535+
* MUST include a resumeAfter option and MUST NOT include a startAfter
1536+
* option when resuming a change stream."
15211537
*/
15221538
public function testResumingChangeStreamWithPreviousResultsIncludesResumeAfterOption()
15231539
{

0 commit comments

Comments
 (0)