public function testTestCreateForNoParserFoundForToken() { $token = new Token('foo', new TokenType(TokenType::DYNAMIC_ARRAY_TYPE)); $exception = ExpressionLanguageExceptionFactory::createForNoParserFoundForToken($token); $this->assertEquals('No suitable token parser found to handle the token "foo" (type: DYNAMIC_ARRAY_TYPE).', $exception->getMessage()); $this->assertEquals(0, $exception->getCode()); $this->assertNull($exception->getPrevious()); }
/** * @inheritdoc */ public function parse(Token $token) { foreach ($this->parsers as $parser) { if ($parser->canParse($token)) { return $parser->parse($token); } } throw ExpressionLanguageExceptionFactory::createForNoParserFoundForToken($token); }