Html5ParserCrawlerTest.php 844 B

12345678910111213141516171819202122232425262728
  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\DomCrawler\Tests;
  11. class Html5ParserCrawlerTest extends AbstractCrawlerTest
  12. {
  13. public function getDoctype(): string
  14. {
  15. return '<!DOCTYPE html>';
  16. }
  17. public function testAddHtml5()
  18. {
  19. // Ensure a bug specific to the DOM extension is fixed (see https://github.com/symfony/symfony/issues/28596)
  20. $crawler = $this->createCrawler();
  21. $crawler->add($this->getDoctype().'<html><body><h1><p>Foo</p></h1></body></html>');
  22. $this->assertEquals('Foo', $crawler->filterXPath('//h1')->text(), '->add() adds nodes from a string');
  23. }
  24. }