$normalizedData1 =
$normalizer->
denormalize($data +
['bar' => 'bar'
], AbstractDummy::
class, 'any',
[ AbstractNormalizer::OBJECT_TO_POPULATE =>
new AbstractDummyFirstChild('notfoo', 'notbar'
),
]);
$this->
assertInstanceOf(AbstractDummyFirstChild::
class,
$normalizedData1);
$this->
assertSame('foo',
$normalizedData1->foo
);
$this->
assertSame('notbar',
$normalizedData1->bar
);
$this->
assertInstanceOf(DummyFirstChildQuux::
class,
$normalizedData1->quux
);
$this->
assertSame('quux',
$normalizedData1->quux->
getValue());
$normalizedData2 =
$normalizer->
denormalize($data +
['baz' => 'baz'
], AbstractDummy::
class, 'any',
[ AbstractNormalizer::OBJECT_TO_POPULATE =>
new AbstractDummySecondChild('notfoo', 'notbaz'
),
]);
$this->
assertInstanceOf(AbstractDummySecondChild::
class,
$normalizedData2);
$this->
assertSame('foo',
$normalizedData2->foo
);
$this->
assertSame('baz',
$normalizedData2->baz
);
$this->
assertInstanceOf(DummySecondChildQuux::
class,
$normalizedData2->quux
);
$this->
assertSame('quux',
$normalizedData2->quux->
getValue());
} public function testDenormalizeWithNestedDiscriminatorMap() { $classDiscriminatorResolver =
new class() implements ClassDiscriminatorResolverInterface
{