2006-07-24 02:33:07 +00:00
|
|
|
<?php
|
|
|
|
|
2006-08-05 00:30:31 +00:00
|
|
|
require_once 'HTMLPurifier/StrategyHarness.php';
|
2006-07-24 02:33:07 +00:00
|
|
|
require_once 'HTMLPurifier/Strategy/RemoveForeignElements.php';
|
|
|
|
|
|
|
|
class HTMLPurifier_Strategy_RemoveForeignElementsTest
|
2006-10-01 21:55:13 +00:00
|
|
|
extends HTMLPurifier_StrategyHarness
|
2006-07-24 02:33:07 +00:00
|
|
|
{
|
|
|
|
|
2006-10-01 21:55:13 +00:00
|
|
|
function setUp() {
|
|
|
|
parent::setUp();
|
|
|
|
$this->obj = new HTMLPurifier_Strategy_RemoveForeignElements();
|
|
|
|
}
|
|
|
|
|
2006-07-24 02:33:07 +00:00
|
|
|
function test() {
|
|
|
|
|
|
|
|
|
2006-10-01 21:55:13 +00:00
|
|
|
$this->assertResult('');
|
2006-07-24 02:33:07 +00:00
|
|
|
|
2006-10-01 21:55:13 +00:00
|
|
|
$this->assertResult('This is <b>bold text</b>.');
|
2006-07-24 02:33:07 +00:00
|
|
|
|
2006-10-01 21:55:13 +00:00
|
|
|
$this->assertResult(
|
|
|
|
'<asdf>Bling</asdf><d href="bang">Bong</d><foobar />',
|
|
|
|
'BlingBong'
|
|
|
|
);
|
2006-07-24 02:33:07 +00:00
|
|
|
|
2006-10-01 21:55:13 +00:00
|
|
|
$this->assertResult(
|
|
|
|
'<menu><li>Item 1</li></menu>',
|
|
|
|
'<ul><li>Item 1</li></ul>'
|
|
|
|
);
|
2006-08-02 02:24:03 +00:00
|
|
|
|
|
|
|
// test center transform
|
2006-10-01 21:55:13 +00:00
|
|
|
$this->assertResult(
|
|
|
|
'<center>Look I am Centered!</center>',
|
|
|
|
'<div style="text-align:center;">Look I am Centered!</div>'
|
|
|
|
);
|
2006-08-02 02:24:03 +00:00
|
|
|
|
2006-08-03 00:14:10 +00:00
|
|
|
// test font transform
|
2006-10-01 21:55:13 +00:00
|
|
|
$this->assertResult(
|
|
|
|
'<font color="red" face="Arial" size="6">Big Warning!</font>',
|
|
|
|
'<span style="color:red;font-family:Arial;font-size:xx-large;">Big'.
|
|
|
|
' Warning!</span>'
|
|
|
|
);
|
2006-08-03 00:14:10 +00:00
|
|
|
|
2006-07-24 02:33:07 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
?>
|