public parse ( |
||
$token | ||
return |
public function parse(Token $token) : FixtureReferenceValue
{
$value = $token->getValue();
try {
return new FixtureReferenceValue(substr($value, 1));
} catch (\InvalidArgumentException $exception) {
throw ExpressionLanguageExceptionFactory::createForUnparsableToken($token, 0, $exception);
}
}
public function testReturnsAFixtureReferenceValueIfCanParseToken() { $token = new Token('@user', new TokenType(TokenType::SIMPLE_REFERENCE_TYPE)); $expected = new FixtureReferenceValue('user'); $parser = new SimpleReferenceTokenParser(); $actual = $parser->parse($token); $this->assertEquals($expected, $actual); }