You are here

public function DOMTreeBuilderTest::testCDATA in Zircon Profile 8

Same name and namespace in other branches
  1. 8.0 vendor/masterminds/html5/test/HTML5/Parser/DOMTreeBuilderTest.php \Masterminds\HTML5\Tests\Parser\DOMTreeBuilderTest::testCDATA()

File

vendor/masterminds/html5/test/HTML5/Parser/DOMTreeBuilderTest.php, line 356
Test the Tree Builder.

Class

DOMTreeBuilderTest
These tests are functional, not necessarily unit tests.

Namespace

Masterminds\HTML5\Tests\Parser

Code

public function testCDATA() {
  $html = "<!DOCTYPE html><html><math><![CDATA[test]]></math></html>";
  $doc = $this
    ->parse($html);
  $wrapper = $doc
    ->getElementsByTagName('math')
    ->item(0);
  $this
    ->assertEquals(1, $wrapper->childNodes->length);
  $cdata = $wrapper->childNodes
    ->item(0);
  $this
    ->assertEquals(XML_CDATA_SECTION_NODE, $cdata->nodeType);
  $this
    ->assertEquals('test', $cdata->data);
}