tests: Replace assertInternalType with proper method.

See https://github.com/sebastianbergmann/phpunit/issues/3369
This commit is contained in:
Pol Dellaiera 2022-01-04 16:20:49 +01:00
parent 06f8014b76
commit 6ebcd87508
No known key found for this signature in database
GPG Key ID: D476DFE9C67467CA
6 changed files with 14 additions and 20 deletions

View File

@ -33,11 +33,11 @@ final class ConfigCustomizablesEntitiesTest extends KernelTestCase
$customizableEntities = self::$kernel->getContainer() $customizableEntities = self::$kernel->getContainer()
->getParameter('chill_custom_fields.customizables_entities'); ->getParameter('chill_custom_fields.customizables_entities');
$this->assertInternalType('array', $customizableEntities); $this->assertIsArray($customizableEntities);
$this->assertCount(2, $customizableEntities); $this->assertCount(2, $customizableEntities);
foreach ($customizableEntities as $key => $config) { foreach ($customizableEntities as $key => $config) {
$this->assertInternalType('array', $config); $this->assertIsArray($config);
$this->assertArrayHasKey('name', $config); $this->assertArrayHasKey('name', $config);
$this->assertArrayHasKey('class', $config); $this->assertArrayHasKey('class', $config);
} }
@ -56,7 +56,7 @@ final class ConfigCustomizablesEntitiesTest extends KernelTestCase
$customizableEntities = self::$kernel->getContainer() $customizableEntities = self::$kernel->getContainer()
->getParameter('chill_custom_fields.customizables_entities'); ->getParameter('chill_custom_fields.customizables_entities');
$this->assertInternalType('array', $customizableEntities); $this->assertIsArray($customizableEntities);
$this->assertCount(1, $customizableEntities); $this->assertCount(1, $customizableEntities);
} }
} }

View File

@ -140,8 +140,7 @@ abstract class AbstractAggregatorTest extends KernelTestCase
{ {
$filter = $this->getAggregator(); $filter = $this->getAggregator();
$this->assertInternalType( $this->assertIsString(
'string',
$filter->applyOn(), $filter->applyOn(),
'test that the internal type of "applyOn" is a string' 'test that the internal type of "applyOn" is a string'
); );
@ -160,8 +159,7 @@ abstract class AbstractAggregatorTest extends KernelTestCase
{ {
$queryKeys = $this->getAggregator()->getQueryKeys($data); $queryKeys = $this->getAggregator()->getQueryKeys($data);
$this->assertInternalType( $this->assertIsArray(
'array',
$queryKeys, $queryKeys,
'test that the query keys returned are an array' 'test that the query keys returned are an array'
); );
@ -252,7 +250,7 @@ abstract class AbstractAggregatorTest extends KernelTestCase
{ {
$title = $this->getAggregator()->getTitle(); $title = $this->getAggregator()->getTitle();
$this->assertInternalType('string', $title); $this->assertIsString($title);
$this->assertNotEmpty( $this->assertNotEmpty(
$title, $title,
'test that the title is not empty' 'test that the title is not empty'

View File

@ -151,8 +151,7 @@ abstract class AbstractExportTest extends WebTestCase
{ {
$export = $this->getExport(); $export = $this->getExport();
$this->assertInternalType( $this->assertIsString(
'string',
$export->getDescription(), $export->getDescription(),
'Assert that the `getDescription` method return a string' 'Assert that the `getDescription` method return a string'
); );
@ -214,8 +213,7 @@ abstract class AbstractExportTest extends WebTestCase
$results = $this->getExport()->getResult($query, $data); $results = $this->getExport()->getResult($query, $data);
$this->assertInternalType( $this->assertIsArray(
'array',
$results, $results,
'assert that the returned result is an array' 'assert that the returned result is an array'
); );
@ -271,8 +269,7 @@ abstract class AbstractExportTest extends WebTestCase
{ {
$export = $this->getExport(); $export = $this->getExport();
$this->assertInternalType( $this->assertIsString(
'string',
$export->getType(), $export->getType(),
'Assert that the `getType` method return a string' 'Assert that the `getType` method return a string'
); );

View File

@ -126,7 +126,7 @@ abstract class AbstractFilterTest extends KernelTestCase
{ {
$filter = $this->getFilter(); $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' 'test that the description is not empty'
); );
} elseif (is_array($description)) { } elseif (is_array($description)) {
$this->assertInternalType( $this->assertIsString(
'string',
$description[0], $description[0],
'test that the first element in the description array is a string' '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(); $title = $this->getFilter()->getTitle();
$this->assertInternalType('string', $title); $this->assertIsString($title);
$this->assertNotEmpty( $this->assertNotEmpty(
$title, $title,
'test that the title is not empty' 'test that the title is not empty'

View File

@ -48,7 +48,7 @@ final class TokenManagerTest extends KernelTestCase
$tokens = $tokenManager->generate($user, $expiration); $tokens = $tokenManager->generate($user, $expiration);
$this->assertInternalType('array', $tokens); $this->assertIsArray($tokens);
$this->assertArrayHasKey('h', $tokens); $this->assertArrayHasKey('h', $tokens);
$this->assertArrayHasKey('t', $tokens); $this->assertArrayHasKey('t', $tokens);
$this->assertNotEmpty($tokens['h']); $this->assertNotEmpty($tokens['h']);

View File

@ -48,6 +48,6 @@ final class MenuComposerTest extends KernelTestCase
$routes = $this->menuComposer->getRoutesFor('dummy0'); $routes = $this->menuComposer->getRoutesFor('dummy0');
$this->assertInternalType('array', $routes); $this->assertIsArray($routes);
} }
} }