mirror of
https://github.com/ezyang/htmlpurifier.git
synced 2025-10-23 01:26:19 +02:00
Merged r608-621 for 1.3.2 release from trunk.
git-svn-id: http://htmlpurifier.org/svnroot/htmlpurifier/branches/1.3@622 48356398-32a2-884e-a903-53898d9a118a
This commit is contained in:
@@ -25,7 +25,7 @@ class HTMLPurifier_Test extends UnitTestCase
|
||||
function testStrict() {
|
||||
$config = HTMLPurifier_Config::createDefault();
|
||||
$config->set('HTML', 'Strict', true);
|
||||
$this->purifier = new HTMLPurifier($config);
|
||||
$this->purifier = new HTMLPurifier( $config ); // verbose syntax
|
||||
|
||||
$this->assertPurification(
|
||||
'<u>Illegal underline</u>',
|
||||
@@ -40,10 +40,11 @@ class HTMLPurifier_Test extends UnitTestCase
|
||||
}
|
||||
|
||||
function testDifferentAllowedElements() {
|
||||
$config = HTMLPurifier_Config::createDefault();
|
||||
$config->set('HTML', 'AllowedElements', array('b', 'i', 'p', 'a'));
|
||||
$config->set('HTML', 'AllowedAttributes', array('a.href', '*.id'));
|
||||
$this->purifier = new HTMLPurifier($config);
|
||||
|
||||
$this->purifier = new HTMLPurifier(array(
|
||||
'HTML.AllowedElements' => array('b', 'i', 'p', 'a'),
|
||||
'HTML.AllowedAttributes' => array('a.href', '*.id')
|
||||
));
|
||||
|
||||
$this->assertPurification(
|
||||
'<p>Par.</p><p>Para<a href="http://google.com/">gr</a>aph</p>Text<b>Bol<i>d</i></b>'
|
||||
@@ -58,9 +59,7 @@ class HTMLPurifier_Test extends UnitTestCase
|
||||
|
||||
function testDisableURI() {
|
||||
|
||||
$config = HTMLPurifier_Config::createDefault();
|
||||
$config->set('Attr', 'DisableURI', true);
|
||||
$this->purifier = new HTMLPurifier($config);
|
||||
$this->purifier = new HTMLPurifier( array('Attr.DisableURI' => true) );
|
||||
|
||||
$this->assertPurification(
|
||||
'<img src="foobar"/>',
|
||||
@@ -69,6 +68,21 @@ class HTMLPurifier_Test extends UnitTestCase
|
||||
|
||||
}
|
||||
|
||||
function test_purifyArray() {
|
||||
|
||||
$this->purifier = new HTMLPurifier();
|
||||
|
||||
$this->assertEqual(
|
||||
$this->purifier->purifyArray(
|
||||
array('Good', '<b>Sketchy', 'foo' => '<script>bad</script>')
|
||||
),
|
||||
array('Good', '<b>Sketchy</b>', 'foo' => 'bad')
|
||||
);
|
||||
|
||||
$this->assertIsA($this->purifier->context, 'array');
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
?>
|
Reference in New Issue
Block a user