assertIdentical($def->elements, array( 'foobar' => true ,'bang' => true ,'gizmo' => true )); } function testPrepareArray() { $def = new HTMLPurifier_ChildDef_Required(array('href', 'src')); $this->assertIdentical($def->elements, array( 'href' => true ,'src' => true )); } function setUp() { parent::setUp(); $this->obj = new HTMLPurifier_ChildDef_Required('dt | dd'); } function testEmptyInput() { $this->assertResult('', false); } function testRemoveIllegalTagsAndElements() { $this->assertResult( '
Term
Text in an illegal location'. '
Definition
Illegal tag', '
Term
Definition
'); $this->assertResult('How do you do!', false); } function testIgnoreWhitespace() { // whitespace shouldn't trigger it $this->assertResult("\n
Definition
"); } function testPreserveWhitespaceAfterRemoval() { $this->assertResult( '
Definition
', '
Definition
' ); } function testDeleteNodeIfOnlyWhitespace() { $this->assertResult("\t ", false); } function testPCDATAAllowed() { $this->obj = new HTMLPurifier_ChildDef_Required('#PCDATA | b'); $this->assertResult('Out Bold text', 'Out Bold text'); } function testPCDATAAllowedWithEscaping() { $this->obj = new HTMLPurifier_ChildDef_Required('#PCDATA | b'); $this->config->set('Core', 'EscapeInvalidChildren', true); $this->assertResult( 'Out Bold text', 'Out Bold text<img />' ); } }