public function DOMTreeBuilderTest::testFragment in Zircon Profile 8
Same name and namespace in other branches
- 8.0 vendor/masterminds/html5/test/HTML5/Parser/DOMTreeBuilderTest.php \Masterminds\HTML5\Tests\Parser\DOMTreeBuilderTest::testFragment()
File
- vendor/
masterminds/ html5/ test/ HTML5/ Parser/ DOMTreeBuilderTest.php, line 113 - Test the Tree Builder.
Class
- DOMTreeBuilderTest
- These tests are functional, not necessarily unit tests.
Namespace
Masterminds\HTML5\Tests\ParserCode
public function testFragment() {
$html = "<div>test</div><span>test2</span>";
$doc = $this
->parseFragment($html);
$this
->assertInstanceOf('\\DOMDocumentFragment', $doc);
$this
->assertTrue($doc
->hasChildNodes());
$this
->assertEquals('div', $doc->childNodes
->item(0)->tagName);
$this
->assertEquals('test', $doc->childNodes
->item(0)->textContent);
$this
->assertEquals('span', $doc->childNodes
->item(1)->tagName);
$this
->assertEquals('test2', $doc->childNodes
->item(1)->textContent);
}