Skip to content

Commit 87e0acc

Browse files
committed
Fix assertInternalType deprecation in phpunit 9
1 parent d42da57 commit 87e0acc

File tree

3 files changed

+11
-5
lines changed

3 files changed

+11
-5
lines changed

Tests/ContainerBuilderTest.php

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -16,6 +16,7 @@
1616

1717
use PHPUnit\Framework\TestCase;
1818
use Psr\Container\ContainerInterface as PsrContainerInterface;
19+
use Symfony\Bridge\PhpUnit\ForwardCompatTestTrait;
1920
use Symfony\Component\Config\Resource\ComposerResource;
2021
use Symfony\Component\Config\Resource\DirectoryResource;
2122
use Symfony\Component\Config\Resource\FileResource;
@@ -45,6 +46,8 @@
4546

4647
class ContainerBuilderTest extends TestCase
4748
{
49+
use ForwardCompatTestTrait;
50+
4851
public function testDefaultRegisteredDefinitions()
4952
{
5053
$builder = new ContainerBuilder();
@@ -168,7 +171,7 @@ public function testGetCreatesServiceBasedOnDefinition()
168171
$builder = new ContainerBuilder();
169172
$builder->register('foo', 'stdClass');
170173

171-
$this->assertInternalType('object', $builder->get('foo'), '->get() returns the service definition associated with the id');
174+
$this->assertIsObject($builder->get('foo'), '->get() returns the service definition associated with the id');
172175
}
173176

174177
public function testGetReturnsRegisteredService()
@@ -662,7 +665,7 @@ public function testResolveEnvValuesWithArray()
662665
$container->resolveEnvPlaceholders('%dummy%', true);
663666
$container->resolveEnvPlaceholders('%dummy2%', true);
664667

665-
$this->assertInternalType('array', $container->resolveEnvPlaceholders('%dummy2%', true));
668+
$this->assertIsArray($container->resolveEnvPlaceholders('%dummy2%', true));
666669

667670
foreach ($dummyArray as $key => $value) {
668671
$this->assertArrayHasKey($key, $container->resolveEnvPlaceholders('%dummy2%', true));

Tests/Loader/YamlFileLoaderTest.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -599,7 +599,7 @@ public function testAnonymousServices()
599599

600600
// Anonymous service in a callable
601601
$factory = $definition->getFactory();
602-
$this->assertInternalType('array', $factory);
602+
$this->assertIsArray($factory);
603603
$this->assertInstanceOf(Reference::class, $factory[0]);
604604
$this->assertTrue($container->has((string) $factory[0]));
605605
$this->assertRegExp('/^\d+_Quz~[._A-Za-z0-9]{7}$/', (string) $factory[0]);

Tests/ParameterBag/EnvPlaceholderParameterBagTest.php

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -12,10 +12,13 @@
1212
namespace Symfony\Component\DependencyInjection\Tests\ParameterBag;
1313

1414
use PHPUnit\Framework\TestCase;
15+
use Symfony\Bridge\PhpUnit\ForwardCompatTestTrait;
1516
use Symfony\Component\DependencyInjection\ParameterBag\EnvPlaceholderParameterBag;
1617

1718
class EnvPlaceholderParameterBagTest extends TestCase
1819
{
20+
use ForwardCompatTestTrait;
21+
1922
/**
2023
* @expectedException \Symfony\Component\DependencyInjection\Exception\InvalidArgumentException
2124
*/
@@ -42,7 +45,7 @@ public function testMergeWillNotDuplicateIdenticalParameters()
4245
$placeholder = array_values($placeholderForVariable)[0];
4346

4447
$this->assertCount(1, $placeholderForVariable);
45-
$this->assertInternalType('string', $placeholder);
48+
$this->assertIsString($placeholder);
4649
$this->assertContains($envVariableName, $placeholder);
4750
}
4851

@@ -65,7 +68,7 @@ public function testMergeWhereFirstBagIsEmptyWillWork()
6568
$placeholder = array_values($placeholderForVariable)[0];
6669

6770
$this->assertCount(1, $placeholderForVariable);
68-
$this->assertInternalType('string', $placeholder);
71+
$this->assertIsString($placeholder);
6972
$this->assertContains($envVariableName, $placeholder);
7073
}
7174

0 commit comments

Comments
 (0)