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

testIfOnlyOneTokensFoundThenReturnsASimpleValue() public method

    public function testIfOnlyOneTokensFoundThenReturnsASimpleValue()
    {
        $value = 'foo';
        $lexerProphecy = $this->prophesize(LexerInterface::class);
        $lexerProphecy->lex($value)->willReturn([$token1 = new Token('foo', new TokenType(TokenType::STRING_TYPE))]);
        /** @var LexerInterface $lexer */
        $lexer = $lexerProphecy->reveal();
        $tokenParserProphecy = $this->prophesize(TokenParserInterface::class);
        $tokenParserProphecy->parse($token1)->willReturn('parsed_foo');
        /** @var TokenParserInterface $tokenParser */
        $tokenParser = $tokenParserProphecy->reveal();
        $parser = new SimpleParser($lexer, $tokenParser);
        $parsedValue = $parser->parse($value);
        $this->assertEquals('parsed_foo', $parsedValue);
    }