public function DOMTreeBuilderTest::testComment 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::testComment()
File
 
   - vendor/masterminds/html5/test/HTML5/Parser/DOMTreeBuilderTest.php, line 334
- Test the Tree Builder.
Class
  
  - DOMTreeBuilderTest 
- These tests are functional, not necessarily unit tests.
Namespace
  Masterminds\HTML5\Tests\Parser
Code
public function testComment() {
  $html = '<html><!--Hello World.--></html>';
  $doc = $this
    ->parse($html);
  $comment = $doc->documentElement->childNodes
    ->item(0);
  $this
    ->assertEquals(XML_COMMENT_NODE, $comment->nodeType);
  $this
    ->assertEquals("Hello World.", $comment->data);
  $html = '<!--Hello World.--><html></html>';
  $doc = $this
    ->parse($html);
  $comment = $doc->childNodes
    ->item(1);
  $this
    ->assertEquals(XML_COMMENT_NODE, $comment->nodeType);
  $this
    ->assertEquals("Hello World.", $comment->data);
  $comment = $doc->childNodes
    ->item(2);
  $this
    ->assertEquals(XML_ELEMENT_NODE, $comment->nodeType);
  $this
    ->assertEquals("html", $comment->tagName);
}