@@ -935,62 +935,62 @@ public function testChangeStreamExample_1_4()
935935 $ db = new Database ($ this ->manager , $ this ->getDatabaseName ());
936936
937937 // Start Changestream Example 1
938- $ cursor = $ db ->inventory ->watch ();
939- $ cursor ->next ();
940- $ current = $ cursor ->current ();
938+ $ changeStream = $ db ->inventory ->watch ();
939+ $ changeStream ->next ();
940+ $ document = $ changeStream ->current ();
941941 // End Changestream Example 1
942942
943- $ this ->assertNull ($ current );
943+ $ this ->assertNull ($ document );
944944
945945 // Start Changestream Example 2
946- $ cursor = $ db ->inventory ->watch ([], ['fullDocument ' => \MongoDB \Operation \Watch::FULL_DOCUMENT_UPDATE_LOOKUP ]);
947- $ cursor ->next ();
948- $ current = $ cursor ->current ();
946+ $ changeStream = $ db ->inventory ->watch ([], ['fullDocument ' => \MongoDB \Operation \Watch::FULL_DOCUMENT_UPDATE_LOOKUP ]);
947+ $ changeStream ->next ();
948+ $ document = $ changeStream ->current ();
949949 // End Changestream Example 2
950950
951- $ this ->assertNull ($ current );
951+ $ this ->assertNull ($ document );
952952
953953 $ insertedResult = $ db ->inventory ->insertOne (['x ' => 1 ]);
954954 $ insertedId = $ insertedResult ->getInsertedId ();
955- $ cursor ->next ();
956- $ current = $ cursor ->current ();
955+ $ changeStream ->next ();
956+ $ document = $ changeStream ->current ();
957957
958958 $ expectedChange = [
959- '_id ' => $ current ->_id ,
959+ '_id ' => $ document ->_id ,
960960 'operationType ' => 'insert ' ,
961961 'fullDocument ' => ['_id ' => $ insertedId , 'x ' => 1 ],
962962 'ns ' => ['db ' => $ this ->getDatabaseName (), 'coll ' => 'inventory ' ],
963963 'documentKey ' => ['_id ' => $ insertedId ],
964964 ];
965965
966- $ this ->assertSameDocument ($ expectedChange , $ current );
966+ $ this ->assertSameDocument ($ expectedChange , $ document );
967967
968968 // Start Changestream Example 3
969- $ resumeToken = ($ current !== null ) ? $ current ->_id : null ;
969+ $ resumeToken = ($ document !== null ) ? $ document ->_id : null ;
970970 if ($ resumeToken !== null ) {
971- $ cursor = $ db ->inventory ->watch ([], ['resumeAfter ' => $ resumeToken ]);
972- $ cursor ->next ();
971+ $ changeStream = $ db ->inventory ->watch ([], ['resumeAfter ' => $ resumeToken ]);
972+ $ changeStream ->next ();
973973 }
974974 // End Changestream Example 3
975975
976976 $ insertedResult = $ db ->inventory ->insertOne (['x ' => 2 ]);
977977 $ insertedId = $ insertedResult ->getInsertedId ();
978- $ cursor ->next ();
978+ $ changeStream ->next ();
979979
980980 $ expectedChange = [
981- '_id ' => $ cursor ->current ()->_id ,
981+ '_id ' => $ changeStream ->current ()->_id ,
982982 'operationType ' => 'insert ' ,
983983 'fullDocument ' => ['_id ' => $ insertedId , 'x ' => 2 ],
984984 'ns ' => ['db ' => $ this ->getDatabaseName (), 'coll ' => 'inventory ' ],
985985 'documentKey ' => ['_id ' => $ insertedId ],
986986 ];
987987
988- $ this ->assertSameDocument ($ expectedChange , $ cursor ->current ());
988+ $ this ->assertSameDocument ($ expectedChange , $ changeStream ->current ());
989989
990990 // Start Changestream Example 4
991991 $ pipeline = [['$match ' => ['$or ' => [['fullDocument.username ' => 'alice ' ], ['operationType ' => 'delete ' ]]]]];
992- $ cursor = $ db ->inventory ->watch ($ pipeline, [] );
993- $ cursor ->next ();
992+ $ changeStream = $ db ->inventory ->watch ($ pipeline );
993+ $ changeStream ->next ();
994994 // End Changestream Example 4
995995 }
996996
0 commit comments