You are here

public function CrawlerTest::testAddHtmlContent 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::testAddHtmlContent()

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

File

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

Class

CrawlerTest

Namespace

Symfony\Component\DomCrawler\Tests

Code

public function testAddHtmlContent() {
  $crawler = new Crawler();
  $crawler
    ->addHtmlContent('<html><div class="foo"></html>', 'UTF-8');
  $this
    ->assertEquals('foo', $crawler
    ->filterXPath('//div')
    ->attr('class'), '->addHtmlContent() adds nodes from an HTML string');
  $crawler
    ->addHtmlContent('<html><head><base href="http://symfony.com"></head><a href="/contact"></a></html>', 'UTF-8');
  $this
    ->assertEquals('http://symfony.com', $crawler
    ->filterXPath('//base')
    ->attr('href'), '->addHtmlContent() adds nodes from an HTML string');
  $this
    ->assertEquals('http://symfony.com/contact', $crawler
    ->filterXPath('//a')
    ->link()
    ->getUri(), '->addHtmlContent() adds nodes from an HTML string');
}