public denormalize ( Nelmio\Alice\FixtureInterface $scope, Nelmio\Alice\FixtureBuilder\Denormalizer\FlagParserInterface $parser, string $unparsedMethod, array $unparsedArguments ) : Nelmio\Alice\Definition\MethodCallInterface | ||
$scope | Nelmio\Alice\FixtureInterface | |
$parser | Nelmio\Alice\FixtureBuilder\Denormalizer\FlagParserInterface | |
$unparsedMethod | string | |
$unparsedArguments | array | |
return | Nelmio\Alice\Definition\MethodCallInterface |
/** * @dataProvider provideMethods */ 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); } }