Skip to content

Commit a8ace60

Browse files
committed
Fix cursor Id deprecation
1 parent 3ce4d6a commit a8ace60

File tree

2 files changed

+8
-5
lines changed

2 files changed

+8
-5
lines changed

tests/Model/CodecCursorFunctionalTest.php

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -55,12 +55,15 @@ function (...$args) use (&$previousErrorHandler, &$deprecations) {
5555
E_USER_DEPRECATED | E_DEPRECATED,
5656
);
5757

58-
$cursorId = $codecCursor->getId();
58+
$cursorId = $codecCursor->getId(true);
5959
} finally {
6060
restore_error_handler();
6161
}
6262

63-
self::assertInstanceOf(CursorId::class, $cursorId);
63+
self::logicalOr(
64+
self::isInstanceOf(Int64::class),
65+
self::isInstanceOf(CursorId::class),
66+
)->matches($cursorId);
6467

6568
// Expect 2 deprecations: 1 from CodecCursor, one from Cursor
6669
self::assertCount(2, $deprecations);

tests/Operation/WatchFunctionalTest.php

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -720,7 +720,7 @@ public function testInitialCursorIsNotClosed(): void
720720
* reports the cursor as alive. While the cursor ID is accessed through
721721
* ChangeStream, we'll need to use reflection to access the internal
722722
* Cursor and call isDead(). */
723-
$this->assertNotEquals('0', (string) $changeStream->getCursorId());
723+
$this->assertNotEquals('0', (string) $changeStream->getCursorId(true));
724724

725725
$rc = new ReflectionClass(ChangeStream::class);
726726
$rp = $rc->getProperty('iterator');
@@ -1370,11 +1370,11 @@ public function testOriginalReadPreferenceIsPreservedOnResume(): void
13701370
}
13711371

13721372
$changeStream = $operation->execute($secondary);
1373-
$previousCursorId = $changeStream->getCursorId();
1373+
$previousCursorId = $changeStream->getCursorId(true);
13741374
$this->forceChangeStreamResume();
13751375

13761376
$changeStream->next();
1377-
$this->assertNotSame($previousCursorId, $changeStream->getCursorId());
1377+
$this->assertNotSame($previousCursorId, $changeStream->getCursorId(true));
13781378

13791379
$getCursor = Closure::bind(
13801380
fn () => $this->iterator->getInnerIterator(),

0 commit comments

Comments
 (0)