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