blob: 2d6e0050b8cf1545c15feb6d1cf4b4d91d2b700b (
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
34
35
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);
}
}
|