Nelmio\Alice\FixtureBuilder\ExpressionLanguage\Parser\SimpleParserTest::testIfTheLexProcessReturnsMultipleTokensThenTheValueReturnedWillBeAListValue PHP Method

testIfTheLexProcessReturnsMultipleTokensThenTheValueReturnedWillBeAListValue() public method

    public function testIfTheLexProcessReturnsMultipleTokensThenTheValueReturnedWillBeAListValue()
    {
        $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(new ParameterValue('parsed_foo'));
        $tokenParserProphecy->parse($token2)->willReturn('parsed_bar');
        /** @var TokenParserInterface $tokenParser */
        $tokenParser = $tokenParserProphecy->reveal();
        $parser = new SimpleParser($lexer, $tokenParser);
        $parsedValue = $parser->parse($value);
        $this->assertEquals(new ListValue([new ParameterValue('parsed_foo'), 'parsed_bar']), $parsedValue);
    }