summaryrefslogtreecommitdiff
path: root/test/HTML5/Html5Test.php
diff options
context:
space:
mode:
authorMatt Farina <[email protected]>2013-05-30 09:48:05 -0400
committerMatt Farina <[email protected]>2013-05-30 09:48:05 -0400
commitfffeafbfe08e306356acd50cf568ec5904da882c (patch)
tree4d81ce539d89ec38141ce6b635f8e3318737bd4f /test/HTML5/Html5Test.php
parente109d03d1b8755cb783274c94c8b8926f2d7b8a1 (diff)
Added tests to make sure we can parse, save, and then parse the saved document.
Diffstat (limited to 'test/HTML5/Html5Test.php')
-rw-r--r--test/HTML5/Html5Test.php36
1 files changed, 36 insertions, 0 deletions
diff --git a/test/HTML5/Html5Test.php b/test/HTML5/Html5Test.php
new file mode 100644
index 0000000..2d6e005
--- /dev/null
+++ b/test/HTML5/Html5Test.php
@@ -0,0 +1,36 @@
+<?php
+namespace HTML5\Tests;
+
+require_once 'TestCase.php';
+
+class Html5Test extends TestCase {
+
+ public function testLoad() {
+ $dom = \HTML5::load(__DIR__ . '/Html5Test.html');
+ $this->assertInstanceOf('\DOMDocument', $dom);
+ $this->assertEmpty($dom->errors);
+ }
+
+ public function testLoadHTML() {
+ $contents = file_get_contents(__DIR__ . '/Html5Test.html');
+ $dom = \HTML5::loadHTML($contents);
+ $this->assertInstanceOf('\DOMDocument', $dom);
+ $this->assertEmpty($dom->errors);
+ }
+
+ // This test reads a document into a dom, turn the dom into a document,
+ // then tries to read that document again. This makes sure we are reading,
+ // and generating a document that works at a high level.
+ public function testItWorks() {
+ $dom = \HTML5::load(__DIR__ . '/Html5Test.html');
+ $this->assertInstanceOf('\DOMDocument', $dom);
+ $this->assertEmpty($dom->errors);
+
+ $saved = \HTML5::saveHTML($dom);
+
+ $dom2 = \HTML5::loadHTML($saved);
+ $this->assertInstanceOf('\DOMDocument', $dom2);
+ $this->assertEmpty($dom2->errors);
+ }
+
+}