public function DOMTreeBuilderTest::testInstructionProcessor in Zircon Profile 8.0
Same name and namespace in other branches
- 8 vendor/masterminds/html5/test/HTML5/Parser/DOMTreeBuilderTest.php \Masterminds\HTML5\Tests\Parser\DOMTreeBuilderTest::testInstructionProcessor()
File
- vendor/
masterminds/ html5/ test/ HTML5/ Parser/ DOMTreeBuilderTest.php, line 515 - Test the Tree Builder.
Class
- DOMTreeBuilderTest
- These tests are functional, not necessarily unit tests.
Namespace
Masterminds\HTML5\Tests\ParserCode
public function testInstructionProcessor() {
$string = '<!DOCTYPE html><html><?foo bar ?></html>';
$treeBuilder = new DOMTreeBuilder();
$is = new InstructionProcessorMock();
$treeBuilder
->setInstructionProcessor($is);
$input = new StringInputStream($string);
$scanner = new Scanner($input);
$parser = new Tokenizer($scanner, $treeBuilder);
$parser
->parse();
$dom = $treeBuilder
->document();
$div = $dom
->getElementsByTagName('div')
->item(0);
$this
->assertEquals(1, $is->count);
$this
->assertEquals('foo', $is->name);
$this
->assertEquals('bar ', $is->data);
$this
->assertEquals('div', $div->tagName);
$this
->assertEquals('foo', $div->textContent);
}