createForNoParserFoundForToken() public static method

public static createForNoParserFoundForToken ( Token $token ) : ParserNotFoundException
$token Nelmio\Alice\FixtureBuilder\ExpressionLanguage\Token
return ParserNotFoundException
 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());
 }
Exemplo n.º 2
0
 /**
  * @inheritdoc
  */
 public function parse(Token $token)
 {
     foreach ($this->parsers as $parser) {
         if ($parser->canParse($token)) {
             return $parser->parse($token);
         }
     }
     throw ExpressionLanguageExceptionFactory::createForNoParserFoundForToken($token);
 }