public function testAddXmlContentCharset() { $crawler =
$this->
createCrawler();
$crawler->
addXmlContent($this->
getDoctype().'<html><div class="foo">Tiếng Việt</div></html>', 'UTF-8'
);
$this->
assertEquals('Tiếng Việt',
$crawler->
filterXPath('//div'
)->
text());
} public function testAddContent() { $crawler =
$this->
createCrawler();
$crawler->
addContent($this->
getDoctype().'<html><div class="foo"></html>', 'text/html; charset=UTF-8'
);
$this->
assertEquals('foo',
$crawler->
filterXPath('//div'
)->
attr('class'
), '->addContent() adds nodes from an HTML string'
);
$crawler =
$this->
createCrawler();
$crawler->
addContent($this->
getDoctype().'<html><div class="foo"></html>', 'text/html; charset=UTF-8; dir=RTL'
);
$this->
assertEquals('foo',
$crawler->
filterXPath('//div'
)->
attr('class'
), '->addContent() adds nodes from an HTML string with extended content type'
);
$crawler =
$this->
createCrawler();
$crawler->
addContent($this->
getDoctype().'<html><div class="foo"></html>'
);
$this->
assertEquals('foo',
$crawler->
filterXPath('//div'
)->
attr('class'
), '->addContent() uses text/html as the default type'
);
$crawler =
$this->
createCrawler();