4 * This file is part of the Symfony package.
6 * (c) Fabien Potencier <fabien@symfony.com>
8 * For the full copyright and license information, please view the LICENSE
9 * file that was distributed with this source code.
12 namespace Symfony\Component\CssSelector\Tests\Parser\Shortcut;
14 use PHPUnit\Framework\TestCase;
15 use Symfony\Component\CssSelector\Node\SelectorNode;
16 use Symfony\Component\CssSelector\Parser\Shortcut\ClassParser;
19 * @author Jean-François Simon <jeanfrancois.simon@sensiolabs.com>
21 class ClassParserTest extends TestCase
23 /** @dataProvider getParseTestData */
24 public function testParse($source, $representation)
26 $parser = new ClassParser();
27 $selectors = $parser->parse($source);
28 $this->assertCount(1, $selectors);
30 /** @var SelectorNode $selector */
31 $selector = $selectors[0];
32 $this->assertEquals($representation, (string) $selector->getTree());
35 public function getParseTestData()
38 array('.testclass', 'Class[Element[*].testclass]'),
39 array('testel.testclass', 'Class[Element[testel].testclass]'),
40 array('testns|.testclass', 'Class[Element[testns|*].testclass]'),
41 array('testns|*.testclass', 'Class[Element[testns|*].testclass]'),
42 array('testns|testel.testclass', 'Class[Element[testns|testel].testclass]'),