scratch – Blame information for rev 87
?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\Shortcut; |
||
13 | |||
14 | use PHPUnit\Framework\TestCase; |
||
15 | use Symfony\Component\CssSelector\Node\SelectorNode; |
||
16 | use Symfony\Component\CssSelector\Parser\Shortcut\HashParser; |
||
17 | |||
18 | /** |
||
19 | * @author Jean-François Simon <jeanfrancois.simon@sensiolabs.com> |
||
20 | */ |
||
21 | class HashParserTest extends TestCase |
||
22 | { |
||
23 | /** @dataProvider getParseTestData */ |
||
24 | public function testParse($source, $representation) |
||
25 | { |
||
26 | $parser = new HashParser(); |
||
27 | $selectors = $parser->parse($source); |
||
28 | $this->assertCount(1, $selectors); |
||
29 | |||
30 | /** @var SelectorNode $selector */ |
||
31 | $selector = $selectors[0]; |
||
32 | $this->assertEquals($representation, (string) $selector->getTree()); |
||
33 | } |
||
34 | |||
35 | public function getParseTestData() |
||
36 | { |
||
37 | return array( |
||
38 | array('#testid', 'Hash[Element[*]#testid]'), |
||
39 | array('testel#testid', 'Hash[Element[testel]#testid]'), |
||
40 | array('testns|#testid', 'Hash[Element[testns|*]#testid]'), |
||
41 | array('testns|*#testid', 'Hash[Element[testns|*]#testid]'), |
||
42 | array('testns|testel#testid', 'Hash[Element[testns|testel]#testid]'), |
||
43 | ); |
||
44 | } |
||
45 | } |