obj = new HTMLPurifier_Strategy_RemoveForeignElements();
}
function test() {
$this->config = array('HTML.Doctype' => 'XHTML 1.0 Strict');
$this->assertResult('');
$this->assertResult('This is bold text.');
$this->assertResult(
'BlingBong',
'BlingBong'
);
$this->assertResult(
'',
''
);
$this->assertResult(
'',
'alert();',
array('Core.RemoveScriptContents' => false)
);
$this->assertResult(
'
',
''
);
// test center transform
$this->assertResult(
'Look I am Centered!',
'Look I am Centered!
'
);
// test font transform
$this->assertResult(
'Big Warning!',
'Big'.
' Warning!'
);
// test removal of invalid img tag
$this->assertResult(
'',
''
);
// test preservation of valid img tag
$this->assertResult('');
// test preservation of invalid img tag when removal is disabled
$this->assertResult(
'',
true,
array(
'Core.RemoveInvalidImg' => false
)
);
// test transform to unallowed element
$this->assertResult(
'Big Warning!',
'Big Warning!',
array('HTML.Allowed' => 'div')
);
// text-ify commented script contents ( the trailing comment gets
// removed during generation )
$this->assertResult(
'',
'',
array('HTML.Trusted' => true, 'Output.CommentScriptContents' => false)
);
}
}