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';
|
|
|
|
|
|
|
|
class HTMLPurifier_Strategy_CoreTest
|
2006-08-05 00:30:31 +00:00
|
|
|
extends HTMLPurifier_StrategyHarness
|
2006-07-29 17:38:28 +00:00
|
|
|
{
|
|
|
|
|
|
|
|
function test() {
|
|
|
|
$strategy = new HTMLPurifier_Strategy_Core();
|
|
|
|
|
|
|
|
$inputs = array();
|
|
|
|
$expect = array();
|
2006-08-14 02:46:34 +00:00
|
|
|
$config = array();
|
|
|
|
|
|
|
|
$config_escape = HTMLPurifier_Config::createDefault();
|
|
|
|
$config_escape->set('Core', 'EscapeInvalidChildren', true);
|
2006-07-29 17:38:28 +00:00
|
|
|
|
|
|
|
$inputs[0] = '';
|
|
|
|
$expect[0] = '';
|
|
|
|
|
|
|
|
$inputs[1] = '<b>Make well formed.';
|
|
|
|
$expect[1] = '<b>Make well formed.</b>';
|
|
|
|
|
|
|
|
$inputs[2] = '<b><div>Fix nesting.</div></b>';
|
2006-08-14 02:46:34 +00:00
|
|
|
$expect[2] = '<b></b>';
|
2006-07-29 17:38:28 +00:00
|
|
|
|
|
|
|
// behavior may change
|
|
|
|
$inputs[3] = '<asdf>Foreign element removal.</asdf>';
|
|
|
|
$expect[3] = '<asdf>Foreign element removal.</asdf>';
|
|
|
|
|
|
|
|
$inputs[4] = '<foo><b><div>All three.</div></b>';
|
2006-08-14 02:46:34 +00:00
|
|
|
$expect[4] = '<foo><b></b>';
|
2006-07-29 17:38:28 +00:00
|
|
|
|
2006-08-14 02:46:34 +00:00
|
|
|
$this->assertStrategyWorks($strategy, $inputs, $expect, $config);
|
2006-07-29 17:38:28 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
?>
|