$crawler =
$this->
createCrawler();
$crawler->
add($this->
getDoctype().'<html><body>Foo</body></html>'
);
$this->
assertEquals('Foo',
$crawler->
filterXPath('//body'
)->
text(), '->add() adds nodes from a string'
);
} public function testAddMultipleDocumentNode() { $this->
expectException(\InvalidArgumentException::
class);
$this->
expectExceptionMessage('Attaching DOM nodes from multiple documents in the same crawler is forbidden.'
);
$crawler =
$this->
createTestCrawler();
$crawler->
addHtmlContent($this->
getDoctype().'<html><div class="foo"></html>', 'UTF-8'
);
} public function testAddHtmlContent() { $crawler =
$this->
createCrawler();
$crawler->
addHtmlContent($this->
getDoctype().'<html><div class="foo"></html>', 'UTF-8'
);
$this->
assertEquals('foo',
$crawler->
filterXPath('//div'
)->
attr('class'
), '->addHtmlContent() adds nodes from an HTML string'
);
} public function testAddHtmlContentWithBaseTag() {