2006-07-29 17:38:28 +00:00
|
|
|
<?php
|
|
|
|
|
2006-08-05 00:30:31 +00:00
|
|
|
require_once 'HTMLPurifier/StrategyHarness.php';
|
2006-07-29 17:38:28 +00:00
|
|
|
require_once 'HTMLPurifier/Strategy/Core.php';
|
|
|
|
|
2006-10-01 21:55:13 +00:00
|
|
|
class HTMLPurifier_Strategy_CoreTest extends HTMLPurifier_StrategyHarness
|
2006-07-29 17:38:28 +00:00
|
|
|
{
|
|
|
|
|
2006-10-01 21:55:13 +00:00
|
|
|
function setUp() {
|
|
|
|
parent::setUp();
|
|
|
|
$this->obj = new HTMLPurifier_Strategy_Core();
|
|
|
|
}
|
|
|
|
|
2007-08-06 06:22:23 +00:00
|
|
|
function testBlankInput() {
|
2006-10-01 21:55:13 +00:00
|
|
|
$this->assertResult('');
|
2007-08-06 06:22:23 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
function testMakeWellFormed() {
|
2006-10-01 21:55:13 +00:00
|
|
|
$this->assertResult(
|
|
|
|
'<b>Make well formed.',
|
|
|
|
'<b>Make well formed.</b>'
|
|
|
|
);
|
2007-08-06 06:22:23 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
function testFixNesting() {
|
2006-10-01 21:55:13 +00:00
|
|
|
$this->assertResult(
|
|
|
|
'<b><div>Fix nesting.</div></b>',
|
2007-06-23 20:52:57 +00:00
|
|
|
'<b></b><div>Fix nesting.</div>'
|
2006-10-01 21:55:13 +00:00
|
|
|
);
|
2007-08-06 06:22:23 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
function testRemoveForeignElements() {
|
2006-10-01 21:55:13 +00:00
|
|
|
$this->assertResult(
|
|
|
|
'<asdf>Foreign element removal.</asdf>',
|
|
|
|
'Foreign element removal.'
|
|
|
|
);
|
2007-08-06 06:22:23 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
function testFirstThree() {
|
2006-10-01 21:55:13 +00:00
|
|
|
$this->assertResult(
|
|
|
|
'<foo><b><div>All three.</div></b>',
|
2007-06-23 20:52:57 +00:00
|
|
|
'<b></b><div>All three.</div>'
|
2006-10-01 21:55:13 +00:00
|
|
|
);
|
2006-07-29 17:38:28 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
}
|
|
|
|
|