Nelmio\Alice\FixtureBuilder\ExpressionLanguage\Parser\TokenParser\Chainable\FixtureMethodReferenceTokenParserTest::testThrowsAnExceptionIfParsingReturnsAnUnexpectedResult PHP Method

testThrowsAnExceptionIfParsingReturnsAnUnexpectedResult() public method

public testThrowsAnExceptionIfParsingReturnsAnUnexpectedResult ( Nelmio\Alice\FixtureBuilder\ExpressionLanguage\ParserInterface $decoratedParser )
$decoratedParser Nelmio\Alice\FixtureBuilder\ExpressionLanguage\ParserInterface
    public function testThrowsAnExceptionIfParsingReturnsAnUnexpectedResult(ParserInterface $decoratedParser)
    {
        try {
            $token = new Token('@user->getName()', new TokenType(TokenType::METHOD_REFERENCE_TYPE));
            $parser = new FixtureMethodReferenceTokenParser($decoratedParser);
            $parser->parse($token);
            $this->fail('Expected exception to be thrown.');
        } catch (ParseException $exception) {
            $this->assertEquals('Could not parse the token "@user->getName()" (type: METHOD_REFERENCE_TYPE).', $exception->getMessage());
            $this->assertEquals(0, $exception->getCode());
            $this->assertNotNull($exception->getPrevious());
        }
    }