EmptyStringParserTest.php 1010 B

1234567891011121314151617181920212223242526272829303132333435
  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 Symfony\Component\CssSelector\Node\SelectorNode;
  12. use Symfony\Component\CssSelector\Parser\Shortcut\EmptyStringParser;
  13. /**
  14. * @author Jean-François Simon <jeanfrancois.simon@sensiolabs.com>
  15. */
  16. class EmptyStringParserTest extends \PHPUnit_Framework_TestCase
  17. {
  18. public function testParse()
  19. {
  20. $parser = new EmptyStringParser();
  21. $selectors = $parser->parse('');
  22. $this->assertCount(1, $selectors);
  23. /** @var SelectorNode $selector */
  24. $selector = $selectors[0];
  25. $this->assertEquals('Element[*]', (string) $selector->getTree());
  26. $selectors = $parser->parse('this will produce an empty array');
  27. $this->assertCount(0, $selectors);
  28. }
  29. }