You are here

public function CrawlerTest::testAddHtmlContentWithErrors in Zircon Profile 8

Same name and namespace in other branches
  1. 8.0 vendor/symfony/dom-crawler/Tests/CrawlerTest.php \Symfony\Component\DomCrawler\Tests\CrawlerTest::testAddHtmlContentWithErrors()

@covers Symfony\Component\DomCrawler\Crawler::addHtmlContent

File

vendor/symfony/dom-crawler/Tests/CrawlerTest.php, line 133

Class

CrawlerTest

Namespace

Symfony\Component\DomCrawler\Tests

Code

public function testAddHtmlContentWithErrors() {
  $internalErrors = libxml_use_internal_errors(true);
  $crawler = new Crawler();
  $crawler
    ->addHtmlContent(<<<EOF
<!DOCTYPE html>
<html>
    <head>
    </head>
    <body>
        <nav><a href="#"><a href="#"></nav>
    </body>
</html>
EOF
, 'UTF-8');
  $errors = libxml_get_errors();
  $this
    ->assertCount(1, $errors);
  $this
    ->assertEquals("Tag nav invalid\n", $errors[0]->message);
  libxml_clear_errors();
  libxml_use_internal_errors($internalErrors);
}