scratch – Blame information for rev
?pathlinks?
Rev | Author | Line No. | Line |
---|---|---|---|
87 | office | 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\CommentHandler; |
||
15 | use Symfony\Component\CssSelector\Parser\Reader; |
||
16 | use Symfony\Component\CssSelector\Parser\Token; |
||
17 | use Symfony\Component\CssSelector\Parser\TokenStream; |
||
18 | |||
19 | class CommentHandlerTest extends AbstractHandlerTest |
||
20 | { |
||
21 | /** @dataProvider getHandleValueTestData */ |
||
22 | public function testHandleValue($value, Token $unusedArgument, $remainingContent) |
||
23 | { |
||
24 | $reader = new Reader($value); |
||
25 | $stream = new TokenStream(); |
||
26 | |||
27 | $this->assertTrue($this->generateHandler()->handle($reader, $stream)); |
||
28 | // comments are ignored (not pushed as token in stream) |
||
29 | $this->assertStreamEmpty($stream); |
||
30 | $this->assertRemainingContent($reader, $remainingContent); |
||
31 | } |
||
32 | |||
33 | public function getHandleValueTestData() |
||
34 | { |
||
35 | return array( |
||
36 | // 2nd argument only exists for inherited method compatibility |
||
37 | array('/* comment */', new Token(null, null, null), ''), |
||
38 | array('/* comment */foo', new Token(null, null, null), 'foo'), |
||
39 | ); |
||
40 | } |
||
41 | |||
42 | public function getDontHandleValueTestData() |
||
43 | { |
||
44 | return array( |
||
45 | array('>'), |
||
46 | array('+'), |
||
47 | array(' '), |
||
48 | ); |
||
49 | } |
||
50 | |||
51 | protected function generateHandler() |
||
52 | { |
||
53 | return new CommentHandler(); |
||
54 | } |
||
55 | } |