assertEqual($def->elements, array( 'foobar' => true ,'bang' => true ,'gizmo' => true )); $def = new HTMLPurifier_ChildDef_Required(array('href', 'src')); $this->assertEqual($def->elements, array( 'href' => true ,'src' => true )); } function testPCDATAForbidden() { $this->obj = new HTMLPurifier_ChildDef_Required('dt | dd'); $this->assertResult('', false); $this->assertResult( '
Term
Text in an illegal location'. '
Definition
Illegal tag', '
Term
Definition
'); $this->assertResult('How do you do!', false); // whitespace shouldn't trigger it $this->assertResult("\n
Definition
"); $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 ) ); } } ?>