1
0
mirror of https://github.com/ezyang/htmlpurifier.git synced 2025-08-04 13:18:00 +02:00

Turn on entity parsing for the Lexers. Add PureHTMLDefinition and define removeForeignElements.

git-svn-id: http://htmlpurifier.org/svnroot/html_purifier/trunk@31 48356398-32a2-884e-a903-53898d9a118a
This commit is contained in:
Edward Z. Yang
2006-04-16 03:00:05 +00:00
parent e7f5b1674d
commit c4b23cc775
5 changed files with 223 additions and 5 deletions

View File

@@ -0,0 +1,41 @@
<?php
class UnitTest_PureHTMLDefinition extends UnitTestCase
{
var $def;
function UnitTest_PureHTMLDefinition() {
$this->UnitTestCase();
$this->def = new PureHTMLDefinition();
$this->def->loadData();
}
function test_removeForeignElements() {
$inputs = array();
$expect = array();
$inputs[0] = array();
$expect[0] = $inputs[0];
$inputs[1] = array(
new MF_Text('This is ')
,new MF_StartTag('b', array())
,new MF_Text('bold')
,new MF_EndTag('b')
,new MF_Text(' text')
);
$expect[1] = $inputs[1];
foreach ($inputs as $i => $input) {
$result = $this->def->removeForeignElements($input);
$this->assertEqual($result, $expect[$i]);
paintIf($result, $result != $expect[$i]);
}
}
}
?>