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());
}
}