diff options
author | Asmir Mustafic <[email protected]> | 2015-01-06 22:28:44 +0100 |
---|---|---|
committer | Asmir Mustafic <[email protected]> | 2015-02-06 22:18:25 +0100 |
commit | 46c4738fe893b8250da1531e093f3ccaee0769a9 (patch) | |
tree | 12fd76b2dc06c876c9626379ed3198c8fc7b03b8 /test/HTML5/Parser | |
parent | 23a692b708ed24f69480aaa59a9dfbb3e9a606d2 (diff) |
Added tests for "target_document" and "disable_html_ns" options
Diffstat (limited to 'test/HTML5/Parser')
-rw-r--r-- | test/HTML5/Parser/DOMTreeBuilderTest.php | 24 |
1 files changed, 23 insertions, 1 deletions
diff --git a/test/HTML5/Parser/DOMTreeBuilderTest.php b/test/HTML5/Parser/DOMTreeBuilderTest.php index 5bba7cc..b2a2d39 100644 --- a/test/HTML5/Parser/DOMTreeBuilderTest.php +++ b/test/HTML5/Parser/DOMTreeBuilderTest.php @@ -55,6 +55,7 @@ class DOMTreeBuilderTest extends \Masterminds\HTML5\Tests\TestCase $this->assertInstanceOf('\DOMDocument', $doc); $this->assertEquals('html', $doc->documentElement->tagName); + $this->assertEquals('http://www.w3.org/1999/xhtml', $doc->documentElement->namespaceURI); } public function testStrangeCapitalization() @@ -78,6 +79,28 @@ class DOMTreeBuilderTest extends \Masterminds\HTML5\Tests\TestCase $this->assertEquals("foo", $xpath->query( "//x:script" )->item( 0 )->nodeValue); } + public function testDocumentWithDisabledNamespaces() + { + $html = "<!DOCTYPE html><html></html>"; + $doc = $this->parse($html, array('disable_html_ns' => true)); + + $this->assertInstanceOf('\DOMDocument', $doc); + $this->assertEquals('html', $doc->documentElement->tagName); + $this->assertNull($doc->documentElement->namespaceURI); + } + + public function testDocumentWithATargetDocument() + { + $targetDom = new \DOMDocument(); + + $html = "<!DOCTYPE html><html></html>"; + $doc = $this->parse($html, array('target_document' => $targetDom)); + + $this->assertInstanceOf('\DOMDocument', $doc); + $this->assertSame($doc, $targetDom); + $this->assertEquals('html', $doc->documentElement->tagName); + } + public function testDocumentFakeAttrAbsence() { $html = "<!DOCTYPE html><html xmlns=\"http://www.w3.org/1999/xhtml\"><body>foo</body></html>"; @@ -85,7 +108,6 @@ class DOMTreeBuilderTest extends \Masterminds\HTML5\Tests\TestCase $xp = new \DOMXPath($doc); $this->assertEquals(0, $xp->query("//@html5-php-fake-id-attribute")->length); - } public function testFragment() |