PHPLIB-462: Replace assertInternalType with type-specific methods

parent 82418090
...@@ -67,7 +67,7 @@ class ClientTest extends TestCase ...@@ -67,7 +67,7 @@ class ClientTest extends TestCase
$this->assertSame(ReadConcern::LOCAL, $debug['readConcern']->getLevel()); $this->assertSame(ReadConcern::LOCAL, $debug['readConcern']->getLevel());
$this->assertInstanceOf(\MongoDB\Driver\ReadPreference::class, $debug['readPreference']); $this->assertInstanceOf(\MongoDB\Driver\ReadPreference::class, $debug['readPreference']);
$this->assertSame(ReadPreference::RP_SECONDARY_PREFERRED, $debug['readPreference']->getMode()); $this->assertSame(ReadPreference::RP_SECONDARY_PREFERRED, $debug['readPreference']->getMode());
$this->assertInternalType('array', $debug['typeMap']); $this->assertIsArray($debug['typeMap']);
$this->assertSame(['root' => 'array'], $debug['typeMap']); $this->assertSame(['root' => 'array'], $debug['typeMap']);
$this->assertInstanceOf(\MongoDB\Driver\WriteConcern::class, $debug['writeConcern']); $this->assertInstanceOf(\MongoDB\Driver\WriteConcern::class, $debug['writeConcern']);
$this->assertSame(WriteConcern::MAJORITY, $debug['writeConcern']->getW()); $this->assertSame(WriteConcern::MAJORITY, $debug['writeConcern']->getW());
...@@ -90,7 +90,7 @@ class ClientTest extends TestCase ...@@ -90,7 +90,7 @@ class ClientTest extends TestCase
$this->assertSame(ReadConcern::LOCAL, $debug['readConcern']->getLevel()); $this->assertSame(ReadConcern::LOCAL, $debug['readConcern']->getLevel());
$this->assertInstanceOf(\MongoDB\Driver\ReadPreference::class, $debug['readPreference']); $this->assertInstanceOf(\MongoDB\Driver\ReadPreference::class, $debug['readPreference']);
$this->assertSame(ReadPreference::RP_SECONDARY_PREFERRED, $debug['readPreference']->getMode()); $this->assertSame(ReadPreference::RP_SECONDARY_PREFERRED, $debug['readPreference']->getMode());
$this->assertInternalType('array', $debug['typeMap']); $this->assertIsArray($debug['typeMap']);
$this->assertSame(['root' => 'array'], $debug['typeMap']); $this->assertSame(['root' => 'array'], $debug['typeMap']);
$this->assertInstanceOf(\MongoDB\Driver\WriteConcern::class, $debug['writeConcern']); $this->assertInstanceOf(\MongoDB\Driver\WriteConcern::class, $debug['writeConcern']);
$this->assertSame(WriteConcern::MAJORITY, $debug['writeConcern']->getW()); $this->assertSame(WriteConcern::MAJORITY, $debug['writeConcern']->getW());
...@@ -129,7 +129,7 @@ class ClientTest extends TestCase ...@@ -129,7 +129,7 @@ class ClientTest extends TestCase
$this->assertSame(ReadConcern::LOCAL, $debug['readConcern']->getLevel()); $this->assertSame(ReadConcern::LOCAL, $debug['readConcern']->getLevel());
$this->assertInstanceOf(\MongoDB\Driver\ReadPreference::class, $debug['readPreference']); $this->assertInstanceOf(\MongoDB\Driver\ReadPreference::class, $debug['readPreference']);
$this->assertSame(ReadPreference::RP_SECONDARY_PREFERRED, $debug['readPreference']->getMode()); $this->assertSame(ReadPreference::RP_SECONDARY_PREFERRED, $debug['readPreference']->getMode());
$this->assertInternalType('array', $debug['typeMap']); $this->assertIsArray($debug['typeMap']);
$this->assertSame(['root' => 'array'], $debug['typeMap']); $this->assertSame(['root' => 'array'], $debug['typeMap']);
$this->assertInstanceOf(\MongoDB\Driver\WriteConcern::class, $debug['writeConcern']); $this->assertInstanceOf(\MongoDB\Driver\WriteConcern::class, $debug['writeConcern']);
$this->assertSame(WriteConcern::MAJORITY, $debug['writeConcern']->getW()); $this->assertSame(WriteConcern::MAJORITY, $debug['writeConcern']->getW());
...@@ -152,7 +152,7 @@ class ClientTest extends TestCase ...@@ -152,7 +152,7 @@ class ClientTest extends TestCase
$this->assertSame(ReadConcern::LOCAL, $debug['readConcern']->getLevel()); $this->assertSame(ReadConcern::LOCAL, $debug['readConcern']->getLevel());
$this->assertInstanceOf(\MongoDB\Driver\ReadPreference::class, $debug['readPreference']); $this->assertInstanceOf(\MongoDB\Driver\ReadPreference::class, $debug['readPreference']);
$this->assertSame(ReadPreference::RP_SECONDARY_PREFERRED, $debug['readPreference']->getMode()); $this->assertSame(ReadPreference::RP_SECONDARY_PREFERRED, $debug['readPreference']->getMode());
$this->assertInternalType('array', $debug['typeMap']); $this->assertIsArray($debug['typeMap']);
$this->assertSame(['root' => 'array'], $debug['typeMap']); $this->assertSame(['root' => 'array'], $debug['typeMap']);
$this->assertInstanceOf(\MongoDB\Driver\WriteConcern::class, $debug['writeConcern']); $this->assertInstanceOf(\MongoDB\Driver\WriteConcern::class, $debug['writeConcern']);
$this->assertSame(WriteConcern::MAJORITY, $debug['writeConcern']->getW()); $this->assertSame(WriteConcern::MAJORITY, $debug['writeConcern']->getW());
......
...@@ -262,7 +262,7 @@ class CollectionFunctionalTest extends FunctionalTestCase ...@@ -262,7 +262,7 @@ class CollectionFunctionalTest extends FunctionalTestCase
$this->assertSame(ReadConcern::LOCAL, $debug['readConcern']->getLevel()); $this->assertSame(ReadConcern::LOCAL, $debug['readConcern']->getLevel());
$this->assertInstanceOf(\MongoDB\Driver\ReadPreference::class, $debug['readPreference']); $this->assertInstanceOf(\MongoDB\Driver\ReadPreference::class, $debug['readPreference']);
$this->assertSame(ReadPreference::RP_SECONDARY_PREFERRED, $debug['readPreference']->getMode()); $this->assertSame(ReadPreference::RP_SECONDARY_PREFERRED, $debug['readPreference']->getMode());
$this->assertInternalType('array', $debug['typeMap']); $this->assertIsArray($debug['typeMap']);
$this->assertSame(['root' => 'array'], $debug['typeMap']); $this->assertSame(['root' => 'array'], $debug['typeMap']);
$this->assertInstanceOf(\MongoDB\Driver\WriteConcern::class, $debug['writeConcern']); $this->assertInstanceOf(\MongoDB\Driver\WriteConcern::class, $debug['writeConcern']);
$this->assertSame(WriteConcern::MAJORITY, $debug['writeConcern']->getW()); $this->assertSame(WriteConcern::MAJORITY, $debug['writeConcern']->getW());
...@@ -284,7 +284,7 @@ class CollectionFunctionalTest extends FunctionalTestCase ...@@ -284,7 +284,7 @@ class CollectionFunctionalTest extends FunctionalTestCase
$this->assertSame(ReadConcern::LOCAL, $debug['readConcern']->getLevel()); $this->assertSame(ReadConcern::LOCAL, $debug['readConcern']->getLevel());
$this->assertInstanceOf(\MongoDB\Driver\ReadPreference::class, $debug['readPreference']); $this->assertInstanceOf(\MongoDB\Driver\ReadPreference::class, $debug['readPreference']);
$this->assertSame(ReadPreference::RP_SECONDARY_PREFERRED, $debug['readPreference']->getMode()); $this->assertSame(ReadPreference::RP_SECONDARY_PREFERRED, $debug['readPreference']->getMode());
$this->assertInternalType('array', $debug['typeMap']); $this->assertIsArray($debug['typeMap']);
$this->assertSame(['root' => 'array'], $debug['typeMap']); $this->assertSame(['root' => 'array'], $debug['typeMap']);
$this->assertInstanceOf(\MongoDB\Driver\WriteConcern::class, $debug['writeConcern']); $this->assertInstanceOf(\MongoDB\Driver\WriteConcern::class, $debug['writeConcern']);
$this->assertSame(WriteConcern::MAJORITY, $debug['writeConcern']->getW()); $this->assertSame(WriteConcern::MAJORITY, $debug['writeConcern']->getW());
......
...@@ -300,7 +300,7 @@ class CrudSpecFunctionalTest extends FunctionalTestCase ...@@ -300,7 +300,7 @@ class CrudSpecFunctionalTest extends FunctionalTestCase
break; break;
case 'bulkWrite': case 'bulkWrite':
$this->assertInternalType('array', $expectedResult); $this->assertIsArray($expectedResult);
$this->assertInstanceOf(\MongoDB\BulkWriteResult::class, $actualResult); $this->assertInstanceOf(\MongoDB\BulkWriteResult::class, $actualResult);
if (isset($expectedResult['deletedCount'])) { if (isset($expectedResult['deletedCount'])) {
...@@ -357,7 +357,7 @@ class CrudSpecFunctionalTest extends FunctionalTestCase ...@@ -357,7 +357,7 @@ class CrudSpecFunctionalTest extends FunctionalTestCase
case 'deleteMany': case 'deleteMany':
case 'deleteOne': case 'deleteOne':
$this->assertInternalType('array', $expectedResult); $this->assertIsArray($expectedResult);
$this->assertInstanceOf(\MongoDB\DeleteResult::class, $actualResult); $this->assertInstanceOf(\MongoDB\DeleteResult::class, $actualResult);
if (isset($expectedResult['deletedCount'])) { if (isset($expectedResult['deletedCount'])) {
...@@ -375,7 +375,7 @@ class CrudSpecFunctionalTest extends FunctionalTestCase ...@@ -375,7 +375,7 @@ class CrudSpecFunctionalTest extends FunctionalTestCase
break; break;
case 'insertMany': case 'insertMany':
$this->assertInternalType('array', $expectedResult); $this->assertIsArray($expectedResult);
$this->assertInstanceOf(\MongoDB\InsertManyResult::class, $actualResult); $this->assertInstanceOf(\MongoDB\InsertManyResult::class, $actualResult);
if (isset($expectedResult['insertedCount'])) { if (isset($expectedResult['insertedCount'])) {
...@@ -391,7 +391,7 @@ class CrudSpecFunctionalTest extends FunctionalTestCase ...@@ -391,7 +391,7 @@ class CrudSpecFunctionalTest extends FunctionalTestCase
break; break;
case 'insertOne': case 'insertOne':
$this->assertInternalType('array', $expectedResult); $this->assertIsArray($expectedResult);
$this->assertInstanceOf(\MongoDB\InsertOneResult::class, $actualResult); $this->assertInstanceOf(\MongoDB\InsertOneResult::class, $actualResult);
if (isset($expectedResult['insertedCount'])) { if (isset($expectedResult['insertedCount'])) {
...@@ -409,7 +409,7 @@ class CrudSpecFunctionalTest extends FunctionalTestCase ...@@ -409,7 +409,7 @@ class CrudSpecFunctionalTest extends FunctionalTestCase
case 'replaceOne': case 'replaceOne':
case 'updateMany': case 'updateMany':
case 'updateOne': case 'updateOne':
$this->assertInternalType('array', $expectedResult); $this->assertIsArray($expectedResult);
$this->assertInstanceOf(\MongoDB\UpdateResult::class, $actualResult); $this->assertInstanceOf(\MongoDB\UpdateResult::class, $actualResult);
if (isset($expectedResult['matchedCount'])) { if (isset($expectedResult['matchedCount'])) {
......
...@@ -111,7 +111,7 @@ class DatabaseFunctionalTest extends FunctionalTestCase ...@@ -111,7 +111,7 @@ class DatabaseFunctionalTest extends FunctionalTestCase
$commandResult = current($cursor->toArray()); $commandResult = current($cursor->toArray());
$this->assertCommandSucceeded($commandResult); $this->assertCommandSucceeded($commandResult);
$this->assertInternalType('array', $commandResult); $this->assertIsArray($commandResult);
$this->assertArrayHasKey('ismaster', $commandResult); $this->assertArrayHasKey('ismaster', $commandResult);
$this->assertTrue($commandResult['ismaster']); $this->assertTrue($commandResult['ismaster']);
} }
...@@ -207,7 +207,7 @@ class DatabaseFunctionalTest extends FunctionalTestCase ...@@ -207,7 +207,7 @@ class DatabaseFunctionalTest extends FunctionalTestCase
$this->assertSame(ReadConcern::LOCAL, $debug['readConcern']->getLevel()); $this->assertSame(ReadConcern::LOCAL, $debug['readConcern']->getLevel());
$this->assertInstanceOf(\MongoDB\Driver\ReadPreference::class, $debug['readPreference']); $this->assertInstanceOf(\MongoDB\Driver\ReadPreference::class, $debug['readPreference']);
$this->assertSame(ReadPreference::RP_SECONDARY_PREFERRED, $debug['readPreference']->getMode()); $this->assertSame(ReadPreference::RP_SECONDARY_PREFERRED, $debug['readPreference']->getMode());
$this->assertInternalType('array', $debug['typeMap']); $this->assertIsArray($debug['typeMap']);
$this->assertSame(['root' => 'array'], $debug['typeMap']); $this->assertSame(['root' => 'array'], $debug['typeMap']);
$this->assertInstanceOf(\MongoDB\Driver\WriteConcern::class, $debug['writeConcern']); $this->assertInstanceOf(\MongoDB\Driver\WriteConcern::class, $debug['writeConcern']);
$this->assertSame(WriteConcern::MAJORITY, $debug['writeConcern']->getW()); $this->assertSame(WriteConcern::MAJORITY, $debug['writeConcern']->getW());
...@@ -229,7 +229,7 @@ class DatabaseFunctionalTest extends FunctionalTestCase ...@@ -229,7 +229,7 @@ class DatabaseFunctionalTest extends FunctionalTestCase
$this->assertSame(ReadConcern::LOCAL, $debug['readConcern']->getLevel()); $this->assertSame(ReadConcern::LOCAL, $debug['readConcern']->getLevel());
$this->assertInstanceOf(\MongoDB\Driver\ReadPreference::class, $debug['readPreference']); $this->assertInstanceOf(\MongoDB\Driver\ReadPreference::class, $debug['readPreference']);
$this->assertSame(ReadPreference::RP_SECONDARY_PREFERRED, $debug['readPreference']->getMode()); $this->assertSame(ReadPreference::RP_SECONDARY_PREFERRED, $debug['readPreference']->getMode());
$this->assertInternalType('array', $debug['typeMap']); $this->assertIsArray($debug['typeMap']);
$this->assertSame(['root' => 'array'], $debug['typeMap']); $this->assertSame(['root' => 'array'], $debug['typeMap']);
$this->assertInstanceOf(\MongoDB\Driver\WriteConcern::class, $debug['writeConcern']); $this->assertInstanceOf(\MongoDB\Driver\WriteConcern::class, $debug['writeConcern']);
$this->assertSame(WriteConcern::MAJORITY, $debug['writeConcern']->getW()); $this->assertSame(WriteConcern::MAJORITY, $debug['writeConcern']->getW());
...@@ -303,7 +303,7 @@ class DatabaseFunctionalTest extends FunctionalTestCase ...@@ -303,7 +303,7 @@ class DatabaseFunctionalTest extends FunctionalTestCase
$this->assertSame(ReadConcern::LOCAL, $debug['readConcern']->getLevel()); $this->assertSame(ReadConcern::LOCAL, $debug['readConcern']->getLevel());
$this->assertInstanceOf(\MongoDB\Driver\ReadPreference::class, $debug['readPreference']); $this->assertInstanceOf(\MongoDB\Driver\ReadPreference::class, $debug['readPreference']);
$this->assertSame(ReadPreference::RP_SECONDARY_PREFERRED, $debug['readPreference']->getMode()); $this->assertSame(ReadPreference::RP_SECONDARY_PREFERRED, $debug['readPreference']->getMode());
$this->assertInternalType('array', $debug['typeMap']); $this->assertIsArray($debug['typeMap']);
$this->assertSame(['root' => 'array'], $debug['typeMap']); $this->assertSame(['root' => 'array'], $debug['typeMap']);
$this->assertInstanceOf(\MongoDB\Driver\WriteConcern::class, $debug['writeConcern']); $this->assertInstanceOf(\MongoDB\Driver\WriteConcern::class, $debug['writeConcern']);
$this->assertSame(WriteConcern::MAJORITY, $debug['writeConcern']->getW()); $this->assertSame(WriteConcern::MAJORITY, $debug['writeConcern']->getW());
...@@ -325,7 +325,7 @@ class DatabaseFunctionalTest extends FunctionalTestCase ...@@ -325,7 +325,7 @@ class DatabaseFunctionalTest extends FunctionalTestCase
$this->assertSame(ReadConcern::LOCAL, $debug['readConcern']->getLevel()); $this->assertSame(ReadConcern::LOCAL, $debug['readConcern']->getLevel());
$this->assertInstanceOf(\MongoDB\Driver\ReadPreference::class, $debug['readPreference']); $this->assertInstanceOf(\MongoDB\Driver\ReadPreference::class, $debug['readPreference']);
$this->assertSame(ReadPreference::RP_SECONDARY_PREFERRED, $debug['readPreference']->getMode()); $this->assertSame(ReadPreference::RP_SECONDARY_PREFERRED, $debug['readPreference']->getMode());
$this->assertInternalType('array', $debug['typeMap']); $this->assertIsArray($debug['typeMap']);
$this->assertSame(['root' => 'array'], $debug['typeMap']); $this->assertSame(['root' => 'array'], $debug['typeMap']);
$this->assertInstanceOf(\MongoDB\Driver\WriteConcern::class, $debug['writeConcern']); $this->assertInstanceOf(\MongoDB\Driver\WriteConcern::class, $debug['writeConcern']);
$this->assertSame(WriteConcern::MAJORITY, $debug['writeConcern']->getW()); $this->assertSame(WriteConcern::MAJORITY, $debug['writeConcern']->getW());
......
...@@ -498,7 +498,7 @@ class DocumentationExamplesTest extends FunctionalTestCase ...@@ -498,7 +498,7 @@ class DocumentationExamplesTest extends FunctionalTestCase
$this->assertSame(2, $insertManyResult->getInsertedCount()); $this->assertSame(2, $insertManyResult->getInsertedCount());
foreach ($insertManyResult->getInsertedIds() as $id) { foreach ($insertManyResult->getInsertedIds() as $id) {
$this->assertInternalType('int', $id); $this->assertIsInt($id);
} }
$this->assertInventoryCount(2); $this->assertInventoryCount(2);
......
...@@ -502,7 +502,7 @@ class BucketFunctionalTest extends FunctionalTestCase ...@@ -502,7 +502,7 @@ class BucketFunctionalTest extends FunctionalTestCase
$expectedReadLength = min(4096, strlen($input) - strlen($buffer)); $expectedReadLength = min(4096, strlen($input) - strlen($buffer));
$buffer .= $read = fread($stream, 4096); $buffer .= $read = fread($stream, 4096);
$this->assertInternalType('string', $read); $this->assertIsString($read);
$this->assertEquals($expectedReadLength, strlen($read)); $this->assertEquals($expectedReadLength, strlen($read));
} }
......
...@@ -39,7 +39,7 @@ abstract class FunctionalTestCase extends BaseFunctionalTestCase ...@@ -39,7 +39,7 @@ abstract class FunctionalTestCase extends BaseFunctionalTestCase
*/ */
protected function assertStreamContents($expectedContents, $stream) protected function assertStreamContents($expectedContents, $stream)
{ {
$this->assertInternalType('resource', $stream); $this->assertIsResource($stream);
$this->assertSame('stream', get_resource_type($stream)); $this->assertSame('stream', get_resource_type($stream));
$this->assertEquals($expectedContents, stream_get_contents($stream, -1, 0)); $this->assertEquals($expectedContents, stream_get_contents($stream, -1, 0));
} }
......
...@@ -277,7 +277,7 @@ class WatchFunctionalTest extends FunctionalTestCase ...@@ -277,7 +277,7 @@ class WatchFunctionalTest extends FunctionalTestCase
private function assertResumeAfter($expectedResumeToken, stdClass $command) private function assertResumeAfter($expectedResumeToken, stdClass $command)
{ {
$this->assertObjectHasAttribute('pipeline', $command); $this->assertObjectHasAttribute('pipeline', $command);
$this->assertInternalType('array', $command->pipeline); $this->assertIsArray($command->pipeline);
$this->assertArrayHasKey(0, $command->pipeline); $this->assertArrayHasKey(0, $command->pipeline);
$this->assertObjectHasAttribute('$changeStream', $command->pipeline[0]); $this->assertObjectHasAttribute('$changeStream', $command->pipeline[0]);
$this->assertObjectHasAttribute('resumeAfter', $command->pipeline[0]->{'$changeStream'}); $this->assertObjectHasAttribute('resumeAfter', $command->pipeline[0]->{'$changeStream'});
...@@ -354,7 +354,7 @@ class WatchFunctionalTest extends FunctionalTestCase ...@@ -354,7 +354,7 @@ class WatchFunctionalTest extends FunctionalTestCase
private function assertStartAtOperationTime(TimestampInterface $expectedOperationTime, stdClass $command) private function assertStartAtOperationTime(TimestampInterface $expectedOperationTime, stdClass $command)
{ {
$this->assertObjectHasAttribute('pipeline', $command); $this->assertObjectHasAttribute('pipeline', $command);
$this->assertInternalType('array', $command->pipeline); $this->assertIsArray($command->pipeline);
$this->assertArrayHasKey(0, $command->pipeline); $this->assertArrayHasKey(0, $command->pipeline);
$this->assertObjectHasAttribute('$changeStream', $command->pipeline[0]); $this->assertObjectHasAttribute('$changeStream', $command->pipeline[0]);
$this->assertObjectHasAttribute('startAtOperationTime', $command->pipeline[0]->{'$changeStream'}); $this->assertObjectHasAttribute('startAtOperationTime', $command->pipeline[0]->{'$changeStream'});
...@@ -1183,7 +1183,7 @@ class WatchFunctionalTest extends FunctionalTestCase ...@@ -1183,7 +1183,7 @@ class WatchFunctionalTest extends FunctionalTestCase
$rp = $rc->getProperty('resumeCallable'); $rp = $rc->getProperty('resumeCallable');
$rp->setAccessible(true); $rp->setAccessible(true);
$this->assertInternalType('callable', $rp->getValue($changeStream)); $this->assertIsCallable($rp->getValue($changeStream));
// Invalidate the cursor to verify that resumeCallable is unset when the cursor is exhausted. // Invalidate the cursor to verify that resumeCallable is unset when the cursor is exhausted.
$this->dropCollection(); $this->dropCollection();
...@@ -1210,9 +1210,9 @@ class WatchFunctionalTest extends FunctionalTestCase ...@@ -1210,9 +1210,9 @@ class WatchFunctionalTest extends FunctionalTestCase
private function getPostBatchResumeTokenFromReply(stdClass $reply) private function getPostBatchResumeTokenFromReply(stdClass $reply)
{ {
$this->assertObjectHasAttribute('cursor', $reply); $this->assertObjectHasAttribute('cursor', $reply);
$this->assertInternalType('object', $reply->cursor); $this->assertIsObject($reply->cursor);
$this->assertObjectHasAttribute('postBatchResumeToken', $reply->cursor); $this->assertObjectHasAttribute('postBatchResumeToken', $reply->cursor);
$this->assertInternalType('object', $reply->cursor->postBatchResumeToken); $this->assertIsObject($reply->cursor->postBatchResumeToken);
return $reply->cursor->postBatchResumeToken; return $reply->cursor->postBatchResumeToken;
} }
......
...@@ -32,7 +32,7 @@ class CommandMonitoringSpecTest extends FunctionalTestCase ...@@ -32,7 +32,7 @@ class CommandMonitoringSpecTest extends FunctionalTestCase
if (isset($expected->killCursors) && isset($expected->cursors) && is_array($expected->cursors)) { if (isset($expected->killCursors) && isset($expected->cursors) && is_array($expected->cursors)) {
static::assertObjectHasAttribute('cursors', $actual); static::assertObjectHasAttribute('cursors', $actual);
static::assertInternalType('array', $actual->cursors); static::assertIsArray($actual->cursors);
foreach ($expected->cursors as $i => $cursorId) { foreach ($expected->cursors as $i => $cursorId) {
static::assertArrayHasKey($i, $actual->cursors); static::assertArrayHasKey($i, $actual->cursors);
...@@ -63,7 +63,7 @@ class CommandMonitoringSpecTest extends FunctionalTestCase ...@@ -63,7 +63,7 @@ class CommandMonitoringSpecTest extends FunctionalTestCase
{ {
if (isset($expected->cursor->id) && $expected->cursor->id === 42) { if (isset($expected->cursor->id) && $expected->cursor->id === 42) {
static::assertObjectHasAttribute('cursor', $actual); static::assertObjectHasAttribute('cursor', $actual);
static::assertInternalType('object', $actual->cursor); static::assertIsObject($actual->cursor);
static::assertObjectHasAttribute('id', $actual->cursor); static::assertObjectHasAttribute('id', $actual->cursor);
static::assertThat($actual->cursor->id, static::logicalOr( static::assertThat($actual->cursor->id, static::logicalOr(
static::isInstanceOf(Int64::class), static::isInstanceOf(Int64::class),
...@@ -74,7 +74,7 @@ class CommandMonitoringSpecTest extends FunctionalTestCase ...@@ -74,7 +74,7 @@ class CommandMonitoringSpecTest extends FunctionalTestCase
if (isset($expected->cursorsUnknown) && is_array($expected->cursorsUnknown)) { if (isset($expected->cursorsUnknown) && is_array($expected->cursorsUnknown)) {
static::assertObjectHasAttribute('cursorsUnknown', $actual); static::assertObjectHasAttribute('cursorsUnknown', $actual);
static::assertInternalType('array', $actual->cursorsUnknown); static::assertIsArray($actual->cursorsUnknown);
foreach ($expected->cursorsUnknown as $i => $cursorId) { foreach ($expected->cursorsUnknown as $i => $cursorId) {
static::assertArrayHasKey($i, $actual->cursorsUnknown); static::assertArrayHasKey($i, $actual->cursorsUnknown);
...@@ -92,14 +92,14 @@ class CommandMonitoringSpecTest extends FunctionalTestCase ...@@ -92,14 +92,14 @@ class CommandMonitoringSpecTest extends FunctionalTestCase
if (isset($expected->ok) && is_numeric($expected->ok)) { if (isset($expected->ok) && is_numeric($expected->ok)) {
static::assertObjectHasAttribute('ok', $actual); static::assertObjectHasAttribute('ok', $actual);
static::assertInternalType('numeric', $actual->ok); static::assertIsNumeric($actual->ok);
static::assertEquals($expected->ok, $actual->ok); static::assertEquals($expected->ok, $actual->ok);
unset($expected->ok); unset($expected->ok);
} }
if (isset($expected->writeErrors) && is_array($expected->writeErrors)) { if (isset($expected->writeErrors) && is_array($expected->writeErrors)) {
static::assertObjectHasAttribute('writeErrors', $actual); static::assertObjectHasAttribute('writeErrors', $actual);
static::assertInternalType('array', $actual->writeErrors); static::assertIsArray($actual->writeErrors);
foreach ($expected->writeErrors as $i => $expectedWriteError) { foreach ($expected->writeErrors as $i => $expectedWriteError) {
static::assertArrayHasKey($i, $actual->writeErrors); static::assertArrayHasKey($i, $actual->writeErrors);
...@@ -116,7 +116,7 @@ class CommandMonitoringSpecTest extends FunctionalTestCase ...@@ -116,7 +116,7 @@ class CommandMonitoringSpecTest extends FunctionalTestCase
if (isset($expectedWriteError->errmsg) && $expectedWriteError->errmsg === '') { if (isset($expectedWriteError->errmsg) && $expectedWriteError->errmsg === '') {
static::assertObjectHasAttribute('errmsg', $actualWriteError); static::assertObjectHasAttribute('errmsg', $actualWriteError);
static::assertInternalType('string', $actualWriteError->errmsg); static::assertIsString($actualWriteError->errmsg);
static::assertNotEmpty($actualWriteError->errmsg); static::assertNotEmpty($actualWriteError->errmsg);
unset($expected->writeErrors[$i]->errmsg); unset($expected->writeErrors[$i]->errmsg);
} }
......
...@@ -216,7 +216,7 @@ final class ResultExpectation ...@@ -216,7 +216,7 @@ final class ResultExpectation
break; break;
case self::ASSERT_MATCHES_DOCUMENT: case self::ASSERT_MATCHES_DOCUMENT:
$test->assertInternalType('object', $expected); $test->assertIsObject($expected);
$test->assertThat($actual, $test->logicalOr( $test->assertThat($actual, $test->logicalOr(
$test->isType('array'), $test->isType('array'),
$test->isType('object') $test->isType('object')
...@@ -236,7 +236,7 @@ final class ResultExpectation ...@@ -236,7 +236,7 @@ final class ResultExpectation
break; break;
case self::ASSERT_SAME_DOCUMENT: case self::ASSERT_SAME_DOCUMENT:
$test->assertInternalType('object', $expected); $test->assertIsObject($expected);
$test->assertThat($actual, $test->logicalOr( $test->assertThat($actual, $test->logicalOr(
$test->isType('array'), $test->isType('array'),
$test->isType('object') $test->isType('object')
......
...@@ -78,13 +78,13 @@ class TransactionsSpecTest extends FunctionalTestCase ...@@ -78,13 +78,13 @@ class TransactionsSpecTest extends FunctionalTestCase
if (isset($expected->recoveryToken) && $expected->recoveryToken === 42) { if (isset($expected->recoveryToken) && $expected->recoveryToken === 42) {
static::assertObjectHasAttribute('recoveryToken', $actual); static::assertObjectHasAttribute('recoveryToken', $actual);
static::assertInternalType('object', $actual->recoveryToken); static::assertIsObject($actual->recoveryToken);
unset($expected->recoveryToken); unset($expected->recoveryToken);
} }
if (isset($expected->readConcern->afterClusterTime) && $expected->readConcern->afterClusterTime === 42) { if (isset($expected->readConcern->afterClusterTime) && $expected->readConcern->afterClusterTime === 42) {
static::assertObjectHasAttribute('readConcern', $actual); static::assertObjectHasAttribute('readConcern', $actual);
static::assertInternalType('object', $actual->readConcern); static::assertIsObject($actual->readConcern);
static::assertObjectHasAttribute('afterClusterTime', $actual->readConcern); static::assertObjectHasAttribute('afterClusterTime', $actual->readConcern);
static::assertInstanceOf(Timestamp::class, $actual->readConcern->afterClusterTime); static::assertInstanceOf(Timestamp::class, $actual->readConcern->afterClusterTime);
unset($expected->readConcern->afterClusterTime); unset($expected->readConcern->afterClusterTime);
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment