f56430c7e83ab7544b875252db29807862602f0f
[GitHub/WoltLab/WCF.git] /
1 <?php
2
3 /*
4 * This file is part of the Symfony package.
5 *
6 * (c) Fabien Potencier <fabien@symfony.com>
7 *
8 * For the full copyright and license information, please view the LICENSE
9 * file that was distributed with this source code.
10 */
11
12 namespace Symfony\Component\CssSelector\Tests\Parser\Handler;
13
14 use Symfony\Component\CssSelector\Parser\Handler\IdentifierHandler;
15 use Symfony\Component\CssSelector\Parser\Token;
16 use Symfony\Component\CssSelector\Parser\Tokenizer\TokenizerEscaping;
17 use Symfony\Component\CssSelector\Parser\Tokenizer\TokenizerPatterns;
18
19 class IdentifierHandlerTest extends AbstractHandlerTest
20 {
21 public function getHandleValueTestData()
22 {
23 return array(
24 array('foo', new Token(Token::TYPE_IDENTIFIER, 'foo', 0), ''),
25 array('foo|bar', new Token(Token::TYPE_IDENTIFIER, 'foo', 0), '|bar'),
26 array('foo.class', new Token(Token::TYPE_IDENTIFIER, 'foo', 0), '.class'),
27 array('foo[attr]', new Token(Token::TYPE_IDENTIFIER, 'foo', 0), '[attr]'),
28 array('foo bar', new Token(Token::TYPE_IDENTIFIER, 'foo', 0), ' bar'),
29 );
30 }
31
32 public function getDontHandleValueTestData()
33 {
34 return array(
35 array('>'),
36 array('+'),
37 array(' '),
38 array('*|foo'),
39 array('/* comment */'),
40 );
41 }
42
43 protected function generateHandler()
44 {
45 $patterns = new TokenizerPatterns();
46
47 return new IdentifierHandler($patterns, new TokenizerEscaping($patterns));
48 }
49 }