public function testLexValueAndParsesEachTokenToReturnAValue()
{
$value = 'foo';
$lexerProphecy = $this->prophesize(LexerInterface::class);
$lexerProphecy->lex($value)->willReturn([$token1 = new Token('foo', new TokenType(TokenType::STRING_TYPE)), $token2 = new Token('bar', new TokenType(TokenType::VARIABLE_TYPE))]);
/** @var LexerInterface $lexer */
$lexer = $lexerProphecy->reveal();
$tokenParserProphecy = $this->prophesize(TokenParserInterface::class);
$tokenParserProphecy->parse($token1)->willReturn('parsed_foo');
$tokenParserProphecy->parse($token2)->willReturn('parsed_bar');
/** @var TokenParserInterface $tokenParser */
$tokenParser = $tokenParserProphecy->reveal();
$parser = new SimpleParser($lexer, $tokenParser);
$parser->parse($value);
$lexerProphecy->lex(Argument::any())->shouldHaveBeenCalledTimes(1);
$tokenParserProphecy->parse(Argument::any())->shouldHaveBeenCalledTimes(2);
}