Nelmio\Alice\FixtureBuilder\Denormalizer\Fixture\SpecificationBagDenormalizer\Calls\OptionalCallsDenormalizerTest::testDenormalizesMethodWithOptionalCallFlagToReturnAOptionalMethodCall PHP Method

testDenormalizesMethodWithOptionalCallFlagToReturnAOptionalMethodCall() public method

public testDenormalizesMethodWithOptionalCallFlagToReturnAOptionalMethodCall ( Nelmio\Alice\FixtureBuilder\Denormalizer\FlagParserInterface $flagParser, boolean $optional )
$flagParser Nelmio\Alice\FixtureBuilder\Denormalizer\FlagParserInterface
$optional boolean
    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);
        }
    }