3 class HTMLPurifier_HTMLT
extends HTMLPurifier_Harness
7 public function __construct($path) {
9 parent
::__construct($path);
12 public function testHtmlt() {
13 $parser = new HTMLPurifier_StringHashParser();
14 $hash = $parser->parseFile($this->path
); // assume parser normalizes to "\n"
15 if (isset($hash['SKIPIF'])) {
16 if (eval($hash['SKIPIF'])) return;
18 $this->config
->set('Output.Newline', "\n");
19 if (isset($hash['INI'])) {
20 // there should be a more efficient way than writing another
21 // ini file every time... probably means building a parser for
22 // ini (check out the yaml implementation we saw somewhere else)
23 $ini_file = $this->path
. '.ini';
24 file_put_contents($ini_file, $hash['INI']);
25 $this->config
->loadIni($ini_file);
27 $expect = isset($hash['EXPECT']) ?
$hash['EXPECT'] : $hash['HTML'];
28 $this->assertPurification(rtrim($hash['HTML']), rtrim($expect));
29 if (isset($hash['INI'])) unlink($ini_file);