Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Use alternatives for features deprecated in PHPUnit 8 #2078

Merged
merged 1 commit into from Oct 6, 2019
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
Expand Up @@ -615,7 +615,7 @@ public function testEmbeddedDocumentWithDifferentFieldNameAnnotation()
->getQuery()
->getSingleResult();

$this->assertInternalType('array', $test1Data);
$this->assertIsArray($test1Data);

$this->assertArrayHasKey('m_id', $test1Data['embedOne']);
}
Expand Down
2 changes: 1 addition & 1 deletion tests/Doctrine/ODM/MongoDB/Tests/Functional/LockTest.php
Expand Up @@ -79,7 +79,7 @@ public function testMultipleFlushesDoIncrementalUpdates()
$this->dm->persist($test);
$this->dm->flush();

$this->assertInternalType('int', $test->getVersion());
$this->assertIsInt($test->getVersion());
$this->assertEquals($i + 1, $test->getVersion());
}
}
Expand Down
Expand Up @@ -41,7 +41,7 @@ public function testSimple()

$doc = $this->dm->find(Order::class, $order->id);
$this->assertInstanceOf(Order::class, $order);
$this->assertInternalType('string', $doc->product->id);
$this->assertIsString($doc->product->id);
$this->assertEquals((string) $test['product']['_id'], $doc->product->id);
$this->assertEquals('Order', $doc->title);
$this->assertEquals('Product', $doc->product->title);
Expand Down
Expand Up @@ -27,7 +27,7 @@ public function testFindAll()
{
$users = $this->repository->findAll();

$this->assertInternalType('array', $users);
$this->assertIsArray($users);
$this->assertCount(1, $users);
}

Expand Down
Expand Up @@ -25,10 +25,10 @@ public function testTest()

$user = $this->dm->find(get_class($order), $order->id);

$this->assertInternalType('int', $order->id);
$this->assertIsInt($order->id);

$check = $this->dm->getDocumentCollection(get_class($orderLog))->findOne();
$this->assertInternalType('int', $check['order']['$id']);
$this->assertIsInt($check['order']['$id']);
}
}

Expand Down
Expand Up @@ -210,7 +210,7 @@ public function testAssocations($class)
public function testOwningOneToOneAssocation($class)
{
$this->assertTrue(isset($class->fieldMappings['address']));
$this->assertInternalType('array', $class->fieldMappings['address']);
$this->assertIsArray($class->fieldMappings['address']);
// Check cascading
$this->assertTrue($class->fieldMappings['address']['isCascadeRemove']);
$this->assertFalse($class->fieldMappings['address']['isCascadePersist']);
Expand Down
Expand Up @@ -55,7 +55,7 @@ public function testClassMetadataInstanceSerialization()
$cm->setCollectionCapped(true);
$cm->setCollectionMax(1000);
$cm->setCollectionSize(500);
$this->assertInternalType('array', $cm->getFieldMapping('phonenumbers'));
$this->assertIsArray($cm->getFieldMapping('phonenumbers'));
$this->assertCount(1, $cm->fieldMappings);
$this->assertCount(1, $cm->associationMappings);

Expand All @@ -71,7 +71,7 @@ public function testClassMetadataInstanceSerialization()
$this->assertEquals(['UserParent'], $cm->parentClasses);
$this->assertEquals(UserRepository::class, $cm->customRepositoryClassName);
$this->assertEquals('disc', $cm->discriminatorField);
$this->assertInternalType('array', $cm->getFieldMapping('phonenumbers'));
$this->assertIsArray($cm->getFieldMapping('phonenumbers'));
$this->assertCount(1, $cm->fieldMappings);
$this->assertCount(1, $cm->associationMappings);
$this->assertEquals(['keys' => ['_id' => 1], 'options' => []], $cm->getShardKey());
Expand Down Expand Up @@ -137,7 +137,7 @@ public function testMapManyToManyJoinTableDefaults()
);

$assoc = $cm->fieldMappings['groups'];
$this->assertInternalType('array', $assoc);
$this->assertIsArray($assoc);
}

public function testGetAssociationTargetClassWithoutTargetDocument()
Expand Down
Expand Up @@ -27,7 +27,7 @@ class DefaultGridFSRepositoryTest extends BaseTest
public function testOpenUploadStreamReturnsWritableResource() : void
{
$uploadStream = $this->getRepository()->openUploadStream('somefile.txt');
self::assertInternalType('resource', $uploadStream);
self::assertIsResource($uploadStream);

fwrite($uploadStream, 'contents');
fclose($uploadStream);
Expand All @@ -39,7 +39,7 @@ public function testOpenUploadStreamReturnsWritableResource() : void
self::assertSame('somefile.txt', $file->getFilename());
self::assertSame(8, $file->getLength());
self::assertSame(12345, $file->getChunkSize());
self::assertEquals(new DateTime(), $file->getUploadDate(), '', 1);
self::assertEqualsWithDelta(new DateTime(), $file->getUploadDate(), 1);
self::assertNull($file->getMetadata());
}

Expand All @@ -49,7 +49,7 @@ public function testOpenUploadStreamUsesChunkSizeFromOptions() : void
$uploadOptions->chunkSizeBytes = 1234;

$uploadStream = $this->getRepository()->openUploadStream('somefile.txt', $uploadOptions);
self::assertInternalType('resource', $uploadStream);
self::assertIsResource($uploadStream);

fwrite($uploadStream, 'contents');
fclose($uploadStream);
Expand All @@ -61,7 +61,7 @@ public function testOpenUploadStreamUsesChunkSizeFromOptions() : void
self::assertSame('somefile.txt', $file->getFilename());
self::assertSame(8, $file->getLength());
self::assertSame(1234, $file->getChunkSize());
self::assertEquals(new DateTime(), $file->getUploadDate(), '', 1);
self::assertEqualsWithDelta(new DateTime(), $file->getUploadDate(), 1);
self::assertNull($file->getMetadata());
}

Expand Down Expand Up @@ -96,7 +96,7 @@ public function testUploadFromStreamStoresFile() : void
self::assertSame('somefile.txt', $file->getFilename());
self::assertSame($expectedSize, $file->getLength());
self::assertSame(12345, $file->getChunkSize());
self::assertEquals(new DateTime(), $file->getUploadDate(), '', 1);
self::assertEqualsWithDelta(new DateTime(), $file->getUploadDate(), 1);
self::assertInstanceOf(FileMetadata::class, $file->getMetadata());
self::assertInstanceOf(User::class, $file->getMetadata()->getOwner());
self::assertSame('Foo', $file->getMetadata()->getEmbedOne()->name);
Expand Down Expand Up @@ -151,7 +151,7 @@ public function testUploadFromStreamPassesChunkSize() : void
self::assertSame('somefile.txt', $file->getFilename());
self::assertSame($expectedSize, $file->getLength());
self::assertSame(1234, $file->getChunkSize());
self::assertEquals(new DateTime(), $file->getUploadDate(), '', 1);
self::assertEqualsWithDelta(new DateTime(), $file->getUploadDate(), 1);
self::assertInstanceOf(FileMetadata::class, $file->getMetadata());

$stream = tmpfile();
Expand Down