assertIdentical($def->elements,
array(
'foobar' => true
,'bang' => true
,'gizmo' => true
));
$def = new HTMLPurifier_ChildDef_Required(array('href', 'src'));
$this->assertIdentical($def->elements,
array(
'href' => true
,'src' => true
));
}
function testPCDATAForbidden() {
$this->obj = new HTMLPurifier_ChildDef_Required('dt | dd');
$this->assertResult('', false);
$this->assertResult(
'
TermText in an illegal location'.
'DefinitionIllegal tag',
'TermDefinition');
$this->assertResult('How do you do!', false);
// whitespace shouldn't trigger it
$this->assertResult("\nDefinition ");
$this->assertResult(
'Definition ',
'Definition '
);
$this->assertResult("\t ", false);
}
function testPCDATAAllowed() {
$this->obj = new HTMLPurifier_ChildDef_Required('#PCDATA | b');
$this->assertResult('Bold text', 'Bold text');
// with child escaping on
$this->assertResult(
'Bold text',
'Bold text<img />',
array(
'Core.EscapeInvalidChildren' => true
)
);
}
}
?>