From a736781cc2499a3ab829ddbf7898740e1638d128 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Antonio=20J=2E=20Garc=C3=ADa=20Lagar?= Date: Fri, 10 May 2019 09:08:16 +0200 Subject: [PATCH] Fix test to be compatible with PHP 5.6 --- .../Tests/Fixtures/VariadicConstructorTypedArgsDummy.php | 2 +- .../Tests/Normalizer/AbstractNormalizerTest.php | 9 ++++++--- 2 files changed, 7 insertions(+), 4 deletions(-) diff --git a/src/Symfony/Component/Serializer/Tests/Fixtures/VariadicConstructorTypedArgsDummy.php b/src/Symfony/Component/Serializer/Tests/Fixtures/VariadicConstructorTypedArgsDummy.php index d6fb807d5ba27..9c6fd980a1524 100644 --- a/src/Symfony/Component/Serializer/Tests/Fixtures/VariadicConstructorTypedArgsDummy.php +++ b/src/Symfony/Component/Serializer/Tests/Fixtures/VariadicConstructorTypedArgsDummy.php @@ -15,7 +15,7 @@ class VariadicConstructorTypedArgsDummy { private $foo; - public function __construct(NullableConstructorArgumentDummy ...$foo) + public function __construct(Dummy ...$foo) { $this->foo = $foo; } diff --git a/src/Symfony/Component/Serializer/Tests/Normalizer/AbstractNormalizerTest.php b/src/Symfony/Component/Serializer/Tests/Normalizer/AbstractNormalizerTest.php index df481118bcc62..cce383075a6fe 100644 --- a/src/Symfony/Component/Serializer/Tests/Normalizer/AbstractNormalizerTest.php +++ b/src/Symfony/Component/Serializer/Tests/Normalizer/AbstractNormalizerTest.php @@ -11,6 +11,7 @@ use Symfony\Component\Serializer\Normalizer\PropertyNormalizer; use Symfony\Component\Serializer\Serializer; use Symfony\Component\Serializer\Tests\Fixtures\AbstractNormalizerDummy; +use Symfony\Component\Serializer\Tests\Fixtures\Dummy; use Symfony\Component\Serializer\Tests\Fixtures\NullableConstructorArgumentDummy; use Symfony\Component\Serializer\Tests\Fixtures\ProxyDummy; use Symfony\Component\Serializer\Tests\Fixtures\StaticConstructorDummy; @@ -139,11 +140,13 @@ public function testObjectWithVariadicConstructorTypedArguments() { $normalizer = new PropertyNormalizer(); $normalizer->setSerializer(new Serializer([$normalizer])); - $dummy = $normalizer->denormalize(['foo' => [['foo' => null], ['foo' => null]]], VariadicConstructorTypedArgsDummy::class); - $this->assertInstanceOf(VariadicConstructorTypedArgsDummy::class, $dummy); + $data = ['foo' => [['foo' => 'Foo', 'bar' => 'Bar', 'baz' => 'Baz', 'qux' => 'Qux'], ['foo' => 'FOO', 'bar' => 'BAR', 'baz' => 'BAZ', 'qux' => 'QUX']]]; + $dummy = $normalizer->denormalize($data, VariadicConstructorTypedArgsDummy::class); + $this->assertInstanceOf(VariadicConstructorTypedArgsDummy::class, $dummy); + $this->assertCount(2, $dummy->getFoo()); foreach ($dummy->getFoo() as $foo) { - $this->assertInstanceOf(NullableConstructorArgumentDummy::class, $foo); + $this->assertInstanceOf(Dummy::class, $foo); } } }