$d1 =
new Dummy();
$d1->foo = 'Foo';
$d1->bar = 'Bar';
$d1->baz = 'Baz';
$d1->qux = 'Quz';
$d2 =
new Dummy();
$d2->foo = 'FOO';
$d2->bar = 'BAR';
$d2->baz = 'BAZ';
$d2->qux = 'QUZ';
$obj =
new VariadicConstructorTypedArgsDummy($d1,
$d2);
$serializer =
new Serializer([$normalizer],
[new JsonEncoder()]);
$normalizer->
setSerializer($serializer);
$data =
$serializer->
serialize($obj, 'json'
);
$dummy =
$normalizer->
denormalize(json_decode($data, true
), VariadicConstructorTypedArgsDummy::
class);
$this->
assertInstanceOf(VariadicConstructorTypedArgsDummy::
class,
$dummy);
$this->
assertCount(2,
$dummy->
getFoo());
foreach ($dummy->
getFoo() as $foo) { $this->
assertInstanceOf(Dummy::
class,
$foo);
}