public function testIfParsedValueIsArrayValueThenUniqueFlagAppliesToItsElementInstead()
{
$fixture = new SimpleFixture('dummy_id', 'Dummy', SpecificationBagFactory::create());
$value = 'string value';
$denormalizedValue = new ArrayValue(['foo', 'bar']);
$flags = (new FlagBag(''))->withFlag(new UniqueFlag());
$decoratedDenormalizerProphecy = $this->prophesize(ValueDenormalizerInterface::class);
$decoratedDenormalizerProphecy->denormalize($fixture, $flags, $value)->willReturn($denormalizedValue);
/** @var ValueDenormalizerInterface $decoratedDenormalizer */
$decoratedDenormalizer = $decoratedDenormalizerProphecy->reveal();
$denormalizer = new UniqueValueDenormalizer($decoratedDenormalizer);
$result = $denormalizer->denormalize($fixture, $flags, $value);
$this->assertInstanceOf(ArrayValue::class, $result);
/** @var ArrayValue $result */
$this->assertInstanceOf(UniqueValue::class, $result->getValue()[0]);
$this->stringContains('dummy_id', $result->getValue()[0]->getId());
$this->assertEquals('foo', $result->getValue()[0]->getValue());
$this->assertInstanceOf(UniqueValue::class, $result->getValue()[1]);
$this->stringContains('dummy_id', $result->getValue()[1]->getId());
$this->assertEquals('bar', $result->getValue()[1]->getValue());
}