public function testDenormalizesMethodWithOptionalCallFlagToReturnAOptionalMethodCall(FlagParserInterface $flagParser, bool $optional)
{
$fixture = new FakeFixture();
$unparsedArguments = ['<latitude()>', '<longitude()>'];
$argumentsDenormalizerProphecy = $this->prophesize(ArgumentsDenormalizerInterface::class);
$argumentsDenormalizerProphecy->denormalize($fixture, $flagParser, $unparsedArguments)->willReturn($parsedArguments = [new \stdClass()]);
/** @var ArgumentsDenormalizerInterface $argumentsDenormalizer */
$argumentsDenormalizer = $argumentsDenormalizerProphecy->reveal();
$expected = new SimpleMethodCall('parsed_method', $parsedArguments);
$denormalizer = new OptionalCallsDenormalizer($argumentsDenormalizer);
$actual = $denormalizer->denormalize($fixture, $flagParser, 'something', $unparsedArguments);
if ($optional) {
$this->assertEquals(new OptionalMethodCall($expected, new OptionalFlag(80)), $actual);
} else {
$this->assertEquals($expected, $actual);
}
}