diff options
author | Asmir Mustafic <[email protected]> | 2015-01-06 22:04:33 +0100 |
---|---|---|
committer | Asmir Mustafic <[email protected]> | 2015-01-06 22:04:33 +0100 |
commit | 209adc250df8f73f1989aad309934c5f9f886888 (patch) | |
tree | f836ad642ceb4da6df15cfdf8145154aff3be6e6 /test/HTML5 | |
parent | 398ebb68c9395a67858d230d0610aa3676bebdc7 (diff) |
Added $options to HTML loading methods
Diffstat (limited to 'test/HTML5')
-rw-r--r-- | test/HTML5/Html5Test.php | 30 |
1 files changed, 30 insertions, 0 deletions
diff --git a/test/HTML5/Html5Test.php b/test/HTML5/Html5Test.php index 0ab367c..a1a6c9c 100644 --- a/test/HTML5/Html5Test.php +++ b/test/HTML5/Html5Test.php @@ -28,6 +28,36 @@ class Html5Test extends TestCase return $out; } + public function testLoadOptions() + { + // doc + $dom = $this->html5->loadHTML($this->wrap('<t:tag/>'), array( + 'implicitNamespaces' => array('t' => 'http://example.com'), + "xmlNamespaces" => true + )); + $this->assertInstanceOf('\DOMDocument', $dom); + $this->assertEmpty($this->html5->getErrors()); + $this->assertFalse($this->html5->hasErrors()); + + $xpath = new \DOMXPath( $dom ); + $xpath->registerNamespace( "t", "http://example.com" ); + $this->assertEquals(1, $xpath->query( "//t:tag" )->length); + + // doc fragment + $frag = $this->html5->loadHTMLFragment('<t:tag/>', array( + 'implicitNamespaces' => array('t' => 'http://example.com'), + "xmlNamespaces" => true + )); + $this->assertInstanceOf('\DOMDocumentFragment', $frag); + $this->assertEmpty($this->html5->getErrors()); + $this->assertFalse($this->html5->hasErrors()); + + $frag->ownerDocument->appendChild($frag); + $xpath = new \DOMXPath( $frag->ownerDocument ); + $xpath->registerNamespace( "t", "http://example.com" ); + $this->assertEquals(1, $xpath->query( "//t:tag" , $frag)->length); + } + public function testErrors() { $dom = $this->html5->loadHTML('<xx as>'); |