|
27 | 27 | use MongoDB\Tests\CommandObserver;
|
28 | 28 | use PHPUnit\Framework\Attributes\DataProvider;
|
29 | 29 | use PHPUnit\Framework\Attributes\Group;
|
| 30 | +use PHPUnit\Framework\Constraint\ObjectHasProperty; |
30 | 31 | use PHPUnit\Framework\ExpectationFailedException;
|
31 | 32 | use ReflectionClass;
|
32 | 33 | use stdClass;
|
@@ -722,10 +723,7 @@ public function testInitialCursorIsNotClosed(): void
|
722 | 723 | $this->assertNotEquals('0', (string) $changeStream->getCursorId(true));
|
723 | 724 |
|
724 | 725 | $rc = new ReflectionClass(ChangeStream::class);
|
725 |
| - $rp = $rc->getProperty('iterator'); |
726 |
| - $rp->setAccessible(true); |
727 |
| - |
728 |
| - $iterator = $rp->getValue($changeStream); |
| 726 | + $iterator = $rc->getProperty('iterator')->getValue($changeStream); |
729 | 727 |
|
730 | 728 | $this->assertInstanceOf('IteratorIterator', $iterator);
|
731 | 729 |
|
@@ -1223,7 +1221,6 @@ public function testSessionFreed(): void
|
1223 | 1221 |
|
1224 | 1222 | $rc = new ReflectionClass($changeStream);
|
1225 | 1223 | $rp = $rc->getProperty('resumeCallable');
|
1226 |
| - $rp->setAccessible(true); |
1227 | 1224 |
|
1228 | 1225 | $this->assertIsCallable($rp->getValue($changeStream));
|
1229 | 1226 |
|
@@ -1280,19 +1277,19 @@ function (array $event) use (&$aggregateCommands): void {
|
1280 | 1277 | $aggregateCommands[0]['pipeline'][0]->{'$changeStream'},
|
1281 | 1278 | $this->logicalNot(
|
1282 | 1279 | $this->logicalOr(
|
1283 |
| - $this->objectHasAttribute('resumeAfter'), |
1284 |
| - $this->objectHasAttribute('startAfter'), |
1285 |
| - $this->objectHasAttribute('startAtOperationTime'), |
| 1280 | + new ObjectHasProperty('resumeAfter'), |
| 1281 | + new ObjectHasProperty('startAfter'), |
| 1282 | + new ObjectHasProperty('startAtOperationTime'), |
1286 | 1283 | ),
|
1287 | 1284 | ),
|
1288 | 1285 | );
|
1289 | 1286 |
|
1290 | 1287 | $this->assertThat(
|
1291 | 1288 | $aggregateCommands[1]['pipeline'][0]->{'$changeStream'},
|
1292 | 1289 | $this->logicalOr(
|
1293 |
| - $this->objectHasAttribute('resumeAfter'), |
1294 |
| - $this->objectHasAttribute('startAfter'), |
1295 |
| - $this->objectHasAttribute('startAtOperationTime'), |
| 1290 | + new ObjectHasProperty('resumeAfter'), |
| 1291 | + new ObjectHasProperty('startAfter'), |
| 1292 | + new ObjectHasProperty('startAtOperationTime'), |
1296 | 1293 | ),
|
1297 | 1294 | );
|
1298 | 1295 |
|
|
0 commit comments