From 6ebcd8750844815a0470149d373e582ea801afe2 Mon Sep 17 00:00:00 2001 From: Pol Dellaiera Date: Tue, 4 Jan 2022 16:20:49 +0100 Subject: [PATCH] tests: Replace `assertInternalType` with proper method. See https://github.com/sebastianbergmann/phpunit/issues/3369 --- .../Tests/Config/ConfigCustomizablesEntitiesTest.php | 6 +++--- .../Test/Export/AbstractAggregatorTest.php | 8 +++----- .../ChillMainBundle/Test/Export/AbstractExportTest.php | 9 +++------ .../ChillMainBundle/Test/Export/AbstractFilterTest.php | 7 +++---- .../Tests/Security/PasswordRecover/TokenManagerTest.php | 2 +- .../ChillMainBundle/Tests/Services/MenuComposerTest.php | 2 +- 6 files changed, 14 insertions(+), 20 deletions(-) diff --git a/src/Bundle/ChillCustomFieldsBundle/Tests/Config/ConfigCustomizablesEntitiesTest.php b/src/Bundle/ChillCustomFieldsBundle/Tests/Config/ConfigCustomizablesEntitiesTest.php index 6a2809071..cb8136806 100644 --- a/src/Bundle/ChillCustomFieldsBundle/Tests/Config/ConfigCustomizablesEntitiesTest.php +++ b/src/Bundle/ChillCustomFieldsBundle/Tests/Config/ConfigCustomizablesEntitiesTest.php @@ -33,11 +33,11 @@ final class ConfigCustomizablesEntitiesTest extends KernelTestCase $customizableEntities = self::$kernel->getContainer() ->getParameter('chill_custom_fields.customizables_entities'); - $this->assertInternalType('array', $customizableEntities); + $this->assertIsArray($customizableEntities); $this->assertCount(2, $customizableEntities); foreach ($customizableEntities as $key => $config) { - $this->assertInternalType('array', $config); + $this->assertIsArray($config); $this->assertArrayHasKey('name', $config); $this->assertArrayHasKey('class', $config); } @@ -56,7 +56,7 @@ final class ConfigCustomizablesEntitiesTest extends KernelTestCase $customizableEntities = self::$kernel->getContainer() ->getParameter('chill_custom_fields.customizables_entities'); - $this->assertInternalType('array', $customizableEntities); + $this->assertIsArray($customizableEntities); $this->assertCount(1, $customizableEntities); } } diff --git a/src/Bundle/ChillMainBundle/Test/Export/AbstractAggregatorTest.php b/src/Bundle/ChillMainBundle/Test/Export/AbstractAggregatorTest.php index 9563ed4bf..1a91d4629 100644 --- a/src/Bundle/ChillMainBundle/Test/Export/AbstractAggregatorTest.php +++ b/src/Bundle/ChillMainBundle/Test/Export/AbstractAggregatorTest.php @@ -140,8 +140,7 @@ abstract class AbstractAggregatorTest extends KernelTestCase { $filter = $this->getAggregator(); - $this->assertInternalType( - 'string', + $this->assertIsString( $filter->applyOn(), 'test that the internal type of "applyOn" is a string' ); @@ -160,8 +159,7 @@ abstract class AbstractAggregatorTest extends KernelTestCase { $queryKeys = $this->getAggregator()->getQueryKeys($data); - $this->assertInternalType( - 'array', + $this->assertIsArray( $queryKeys, 'test that the query keys returned are an array' ); @@ -252,7 +250,7 @@ abstract class AbstractAggregatorTest extends KernelTestCase { $title = $this->getAggregator()->getTitle(); - $this->assertInternalType('string', $title); + $this->assertIsString($title); $this->assertNotEmpty( $title, 'test that the title is not empty' diff --git a/src/Bundle/ChillMainBundle/Test/Export/AbstractExportTest.php b/src/Bundle/ChillMainBundle/Test/Export/AbstractExportTest.php index 7a888eb01..18a3f6c66 100644 --- a/src/Bundle/ChillMainBundle/Test/Export/AbstractExportTest.php +++ b/src/Bundle/ChillMainBundle/Test/Export/AbstractExportTest.php @@ -151,8 +151,7 @@ abstract class AbstractExportTest extends WebTestCase { $export = $this->getExport(); - $this->assertInternalType( - 'string', + $this->assertIsString( $export->getDescription(), 'Assert that the `getDescription` method return a string' ); @@ -214,8 +213,7 @@ abstract class AbstractExportTest extends WebTestCase $results = $this->getExport()->getResult($query, $data); - $this->assertInternalType( - 'array', + $this->assertIsArray( $results, 'assert that the returned result is an array' ); @@ -271,8 +269,7 @@ abstract class AbstractExportTest extends WebTestCase { $export = $this->getExport(); - $this->assertInternalType( - 'string', + $this->assertIsString( $export->getType(), 'Assert that the `getType` method return a string' ); diff --git a/src/Bundle/ChillMainBundle/Test/Export/AbstractFilterTest.php b/src/Bundle/ChillMainBundle/Test/Export/AbstractFilterTest.php index d0f4eaa97..4355687e1 100644 --- a/src/Bundle/ChillMainBundle/Test/Export/AbstractFilterTest.php +++ b/src/Bundle/ChillMainBundle/Test/Export/AbstractFilterTest.php @@ -126,7 +126,7 @@ abstract class AbstractFilterTest extends KernelTestCase { $filter = $this->getFilter(); - $this->assertInternalType('string', $filter->applyOn()); + $this->assertIsString($filter->applyOn()); } /** @@ -149,8 +149,7 @@ abstract class AbstractFilterTest extends KernelTestCase 'test that the description is not empty' ); } elseif (is_array($description)) { - $this->assertInternalType( - 'string', + $this->assertIsString( $description[0], 'test that the first element in the description array is a string' ); @@ -191,7 +190,7 @@ abstract class AbstractFilterTest extends KernelTestCase { $title = $this->getFilter()->getTitle(); - $this->assertInternalType('string', $title); + $this->assertIsString($title); $this->assertNotEmpty( $title, 'test that the title is not empty' diff --git a/src/Bundle/ChillMainBundle/Tests/Security/PasswordRecover/TokenManagerTest.php b/src/Bundle/ChillMainBundle/Tests/Security/PasswordRecover/TokenManagerTest.php index cc10e43cb..7208c3ee9 100644 --- a/src/Bundle/ChillMainBundle/Tests/Security/PasswordRecover/TokenManagerTest.php +++ b/src/Bundle/ChillMainBundle/Tests/Security/PasswordRecover/TokenManagerTest.php @@ -48,7 +48,7 @@ final class TokenManagerTest extends KernelTestCase $tokens = $tokenManager->generate($user, $expiration); - $this->assertInternalType('array', $tokens); + $this->assertIsArray($tokens); $this->assertArrayHasKey('h', $tokens); $this->assertArrayHasKey('t', $tokens); $this->assertNotEmpty($tokens['h']); diff --git a/src/Bundle/ChillMainBundle/Tests/Services/MenuComposerTest.php b/src/Bundle/ChillMainBundle/Tests/Services/MenuComposerTest.php index b7df8018e..8ed185aa9 100644 --- a/src/Bundle/ChillMainBundle/Tests/Services/MenuComposerTest.php +++ b/src/Bundle/ChillMainBundle/Tests/Services/MenuComposerTest.php @@ -48,6 +48,6 @@ final class MenuComposerTest extends KernelTestCase $routes = $this->menuComposer->getRoutesFor('dummy0'); - $this->assertInternalType('array', $routes); + $this->assertIsArray($routes); } }