parse() public method

public parse ( Token $token )
$token Nelmio\Alice\FixtureBuilder\ExpressionLanguage\Token
Example #1
0
 public function testReplaceIdentityIntoAFunctionCallBeforeHandingItOverToItsDecorated()
 {
     $token = new Token('<(echo "hello world!")>', new TokenType(TokenType::IDENTITY_TYPE));
     $decoratedParserProphecy = $this->prophesize(ChainableTokenParserInterface::class);
     $decoratedParserProphecy->parse(new Token('<identity(echo "hello world!")>', new TokenType(TokenType::FUNCTION_TYPE)))->willReturn($expected = 'foo');
     /** @var ChainableTokenParserInterface $decoratedParser */
     $decoratedParser = $decoratedParserProphecy->reveal();
     $parser = new IdentityTokenParser($decoratedParser);
     $actual = $parser->parse($token);
     $this->assertEquals($expected, $actual);
     $decoratedParserProphecy->parse(Argument::any())->shouldHaveBeenCalledTimes(1);
 }