Prepended constants with C_ to avoid reserved words as per https://www.php.net/manual...
[htmlpurifier/darkodev.git] / tests / HTMLPurifier / HTMLT.php
blob9e389f4b8417e45edaed97c2024a29bfc46c4386
1 <?php
3 class HTMLPurifier_HTMLT extends HTMLPurifier_Harness
5 protected $path;
7 public function __construct($path)
9 $this->path = $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);
38 // vim: et sw=4 sts=4