Nelmio\Alice\FixtureBuilder\Denormalizer\Fixture\SpecificationBagDenormalizer\Calls\OptionalCallsDenormalizerTest::testDenormalizesInputToReturnAMethodCall PHP Метод

testDenormalizesInputToReturnAMethodCall() публичный Метод

    public function testDenormalizesInputToReturnAMethodCall()
    {
        $fixture = new FakeFixture();
        $unparsedMethod = 'setLocation';
        $unparsedArguments = ['<latitude()>', '<longitude()>'];
        $flagParserProphecy = $this->prophesize(FlagParserInterface::class);
        $flagParserProphecy->parse($unparsedMethod)->willReturn(new FlagBag('parsed_method'));
        /** @var FlagParserInterface $flagParser */
        $flagParser = $flagParserProphecy->reveal();
        $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, $unparsedMethod, $unparsedArguments);
        $this->assertEquals($expected, $actual);
        $flagParserProphecy->parse(Argument::any())->shouldHaveBeenCalledTimes(1);
        $argumentsDenormalizerProphecy->denormalize(Argument::cetera())->shouldHaveBeenCalledTimes(1);
    }