You are here

protected function DOMTreeBuilderTest::parseFragment 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::parseFragment()

Utility function for parsing a fragment of HTML5.

1 call to DOMTreeBuilderTest::parseFragment()
DOMTreeBuilderTest::testFragment in vendor/masterminds/html5/test/HTML5/Parser/DOMTreeBuilderTest.php

File

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

Class

DOMTreeBuilderTest
These tests are functional, not necessarily unit tests.

Namespace

Masterminds\HTML5\Tests\Parser

Code

protected function parseFragment($string) {
  $treeBuilder = new DOMTreeBuilder(true);
  $input = new StringInputStream($string);
  $scanner = new Scanner($input);
  $parser = new Tokenizer($scanner, $treeBuilder);
  $parser
    ->parse();
  $this->errors = $treeBuilder
    ->getErrors();
  return $treeBuilder
    ->fragment();
}