EmptyStringParserTest.php 1023 B

12345678910111213141516171819202122232425262728293031323334353637
  1. <?php
  2. /*
  3. * This file is part of the Symfony package.
  4. *
  5. * (c) Fabien Potencier <fabien@symfony.com>
  6. *
  7. * For the full copyright and license information, please view the LICENSE
  8. * file that was distributed with this source code.
  9. */
  10. namespace Symfony\Component\CssSelector\Tests\Parser\Shortcut;
  11. use PHPUnit\Framework\TestCase;
  12. use Symfony\Component\CssSelector\Node\SelectorNode;
  13. use Symfony\Component\CssSelector\Parser\Shortcut\EmptyStringParser;
  14. /**
  15. * @author Jean-François Simon <jeanfrancois.simon@sensiolabs.com>
  16. */
  17. class EmptyStringParserTest extends TestCase
  18. {
  19. public function testParse()
  20. {
  21. $parser = new EmptyStringParser();
  22. $selectors = $parser->parse('');
  23. $this->assertCount(1, $selectors);
  24. /** @var SelectorNode $selector */
  25. $selector = $selectors[0];
  26. $this->assertEquals('Element[*]', (string) $selector->getTree());
  27. $selectors = $parser->parse('this will produce an empty array');
  28. $this->assertCount(0, $selectors);
  29. }
  30. }