blob: 963000c475accaed34c9c2a1406ed8fa50c637aa (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
|
<?php
/**
* @file
* Test the Scanner. This requires the InputStream tests are all good.
*/
namespace HTML5\Parser;
require_once __DIR__ . '/../TestCase.php';
class DOMTreeBuilderTest extends \HTML5\Tests\TestCase {
/**
* Convenience function for parsing.
*/
protected function parse($string) {
$treeBuilder = new DOMTreeBuilder();
$input = new StringInputStream($string);
$scanner = new Scanner($input);
$parser = new Tokenizer($scanner, $treeBuilder);
$parser->parse();
return $treeBuilder->document();
}
public function testDocument() {
$html = "<!DOCTYPE html><html></html>";
$doc = $this->parse($html);
$this->assertInstanceOf('\DOMDocument', $doc);
$this->assertEquals('html', $doc->documentElement->tagName);
}
}
|