Skip to content

Commit

Permalink
Fix CursorId deprecation in tests
Browse files Browse the repository at this point in the history
  • Loading branch information
GromNaN committed Sep 19, 2024
1 parent b20703f commit c6f9f00
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 5 deletions.
7 changes: 5 additions & 2 deletions tests/Model/CodecCursorFunctionalTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -55,12 +55,15 @@ function (...$args) use (&$previousErrorHandler, &$deprecations) {
E_USER_DEPRECATED | E_DEPRECATED,
);

$cursorId = $codecCursor->getId();
$cursorId = $codecCursor->getId(true);
} finally {
restore_error_handler();
}

self::assertInstanceOf(CursorId::class, $cursorId);
self::logicalOr(
self::isInstanceOf(Int64::class),
self::isInstanceOf(CursorId::class),
)->matches($cursorId);

// Expect 2 deprecations: 1 from CodecCursor, one from Cursor
self::assertCount(2, $deprecations);
Expand Down
6 changes: 3 additions & 3 deletions tests/Operation/WatchFunctionalTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -720,7 +720,7 @@ public function testInitialCursorIsNotClosed(): void
* reports the cursor as alive. While the cursor ID is accessed through
* ChangeStream, we'll need to use reflection to access the internal
* Cursor and call isDead(). */
$this->assertNotEquals('0', (string) $changeStream->getCursorId());
$this->assertNotEquals('0', (string) $changeStream->getCursorId(true));

$rc = new ReflectionClass(ChangeStream::class);
$rp = $rc->getProperty('iterator');
Expand Down Expand Up @@ -1370,11 +1370,11 @@ public function testOriginalReadPreferenceIsPreservedOnResume(): void
}

$changeStream = $operation->execute($secondary);
$previousCursorId = $changeStream->getCursorId();
$previousCursorId = $changeStream->getCursorId(true);
$this->forceChangeStreamResume();

$changeStream->next();
$this->assertNotSame($previousCursorId, $changeStream->getCursorId());
$this->assertNotSame($previousCursorId, $changeStream->getCursorId(true));

$getCursor = Closure::bind(
fn () => $this->iterator->getInnerIterator(),
Expand Down

0 comments on commit c6f9f00

Please sign in to comment.