public parse ( |
||
$token | ||
리턴 |
public function testReturnsAFixtureMethodCallValueIfCanParseToken() { $token = new Token('@user->getUserName(arg1, arg2)', new TokenType(TokenType::METHOD_REFERENCE_TYPE)); $decoratedParserProphecy = $this->prophesize(ParserInterface::class); $decoratedParserProphecy->parse('@user')->willReturn($reference = new FixtureReferenceValue('user')); $decoratedParserProphecy->parse('<getUserName(arg1, arg2)>')->willReturn($call = new FunctionCallValue('getUserName', ['parsed_arg1', 'parsed_arg2'])); /** @var ParserInterface $decoratedParser */ $decoratedParser = $decoratedParserProphecy->reveal(); $expected = new FixtureMethodCallValue($reference, $call); $parser = new MethodReferenceTokenParser($decoratedParser); $actual = $parser->parse($token); $this->assertEquals($expected, $actual); $decoratedParserProphecy->parse(Argument::any())->shouldHaveBeenCalledTimes(2); }