public function testWhenParserThrowsExceptionDenormalizerAExceptionIsThrown()
{
$parserProphecy = $this->prophesize(ParserInterface::class);
$parserProphecy->parse(Argument::any())->willThrow($thrownException = new RootParseException('hello world', 10));
/** @var ParserInterface $parser */
$parser = $parserProphecy->reveal();
$denormalizer = new SimpleValueDenormalizer($parser);
try {
$denormalizer->denormalize(new FakeFixture(), null, 'foo');
$this->fail('Expected throwable to be thrown.');
} catch (DenormalizationThrowable $throwable) {
$this->assertEquals('Could not parse value "foo".', $throwable->getMessage());
$this->assertEquals(0, $throwable->getCode());
$this->assertEquals($thrownException, $throwable->getPrevious());
}
}