Skip to content

Commit

Permalink
Fix test to be compatible with PHP 5.6
Browse files Browse the repository at this point in the history
  • Loading branch information
ajgarlag committed May 10, 2019
1 parent 8ca9a60 commit a736781
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 4 deletions.
Expand Up @@ -15,7 +15,7 @@ class VariadicConstructorTypedArgsDummy
{
private $foo;

public function __construct(NullableConstructorArgumentDummy ...$foo)
public function __construct(Dummy ...$foo)
{
$this->foo = $foo;
}
Expand Down
Expand Up @@ -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;
Expand Down Expand Up @@ -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);
}
}
}

0 comments on commit a736781

Please sign in to comment.