You are here

public function ParserTest::getParserExceptionTestData in Zircon Profile 8.0

Same name and namespace in other branches
  1. 8 vendor/symfony/css-selector/Tests/Parser/ParserTest.php \Symfony\Component\CssSelector\Tests\Parser\ParserTest::getParserExceptionTestData()

File

vendor/symfony/css-selector/Tests/Parser/ParserTest.php, line 140

Class

ParserTest

Namespace

Symfony\Component\CssSelector\Tests\Parser

Code

public function getParserExceptionTestData() {
  return array(
    array(
      'attributes(href)/html/body/a',
      SyntaxErrorException::unexpectedToken('selector', new Token(Token::TYPE_DELIMITER, '(', 10))
        ->getMessage(),
    ),
    array(
      'attributes(href)',
      SyntaxErrorException::unexpectedToken('selector', new Token(Token::TYPE_DELIMITER, '(', 10))
        ->getMessage(),
    ),
    array(
      'html/body/a',
      SyntaxErrorException::unexpectedToken('selector', new Token(Token::TYPE_DELIMITER, '/', 4))
        ->getMessage(),
    ),
    array(
      ' ',
      SyntaxErrorException::unexpectedToken('selector', new Token(Token::TYPE_FILE_END, '', 1))
        ->getMessage(),
    ),
    array(
      'div, ',
      SyntaxErrorException::unexpectedToken('selector', new Token(Token::TYPE_FILE_END, '', 5))
        ->getMessage(),
    ),
    array(
      ' , div',
      SyntaxErrorException::unexpectedToken('selector', new Token(Token::TYPE_DELIMITER, ',', 1))
        ->getMessage(),
    ),
    array(
      'p, , div',
      SyntaxErrorException::unexpectedToken('selector', new Token(Token::TYPE_DELIMITER, ',', 3))
        ->getMessage(),
    ),
    array(
      'div > ',
      SyntaxErrorException::unexpectedToken('selector', new Token(Token::TYPE_FILE_END, '', 6))
        ->getMessage(),
    ),
    array(
      '  > div',
      SyntaxErrorException::unexpectedToken('selector', new Token(Token::TYPE_DELIMITER, '>', 2))
        ->getMessage(),
    ),
    array(
      'foo|#bar',
      SyntaxErrorException::unexpectedToken('identifier or "*"', new Token(Token::TYPE_HASH, 'bar', 4))
        ->getMessage(),
    ),
    array(
      '#.foo',
      SyntaxErrorException::unexpectedToken('selector', new Token(Token::TYPE_DELIMITER, '#', 0))
        ->getMessage(),
    ),
    array(
      '.#foo',
      SyntaxErrorException::unexpectedToken('identifier', new Token(Token::TYPE_HASH, 'foo', 1))
        ->getMessage(),
    ),
    array(
      ':#foo',
      SyntaxErrorException::unexpectedToken('identifier', new Token(Token::TYPE_HASH, 'foo', 1))
        ->getMessage(),
    ),
    array(
      '[*]',
      SyntaxErrorException::unexpectedToken('"|"', new Token(Token::TYPE_DELIMITER, ']', 2))
        ->getMessage(),
    ),
    array(
      '[foo|]',
      SyntaxErrorException::unexpectedToken('identifier', new Token(Token::TYPE_DELIMITER, ']', 5))
        ->getMessage(),
    ),
    array(
      '[#]',
      SyntaxErrorException::unexpectedToken('identifier or "*"', new Token(Token::TYPE_DELIMITER, '#', 1))
        ->getMessage(),
    ),
    array(
      '[foo=#]',
      SyntaxErrorException::unexpectedToken('string or identifier', new Token(Token::TYPE_DELIMITER, '#', 5))
        ->getMessage(),
    ),
    array(
      ':nth-child()',
      SyntaxErrorException::unexpectedToken('at least one argument', new Token(Token::TYPE_DELIMITER, ')', 11))
        ->getMessage(),
    ),
    array(
      '[href]a',
      SyntaxErrorException::unexpectedToken('selector', new Token(Token::TYPE_IDENTIFIER, 'a', 6))
        ->getMessage(),
    ),
    array(
      '[rel:stylesheet]',
      SyntaxErrorException::unexpectedToken('operator', new Token(Token::TYPE_DELIMITER, ':', 4))
        ->getMessage(),
    ),
    array(
      '[rel=stylesheet',
      SyntaxErrorException::unexpectedToken('"]"', new Token(Token::TYPE_FILE_END, '', 15))
        ->getMessage(),
    ),
    array(
      ':lang(fr',
      SyntaxErrorException::unexpectedToken('an argument', new Token(Token::TYPE_FILE_END, '', 8))
        ->getMessage(),
    ),
    array(
      ':contains("foo',
      SyntaxErrorException::unclosedString(10)
        ->getMessage(),
    ),
    array(
      'foo!',
      SyntaxErrorException::unexpectedToken('selector', new Token(Token::TYPE_DELIMITER, '!', 3))
        ->getMessage(),
    ),
  );
}