obj = new HTMLPurifier_Strategy_FixNesting(); } function testBlockAndInlineIntegration() { // legal inline $this->assertResult('Bold text'); // legal inline and block (default parent element is FLOW) $this->assertResult('Blank
Block
'); // illegal block in inline $this->assertResult( '
Illegal div.
', 'Illegal div.' ); // same test with different configuration (fragile) $this->assertResult( '
Illegal div.
', '<div>Illegal div.</div>', array('Core.EscapeInvalidChildren' => true) ); } function testNodeRemovalIntegration() { // test of empty set that's required, resulting in removal of node $this->assertResult('', ''); // test illegal text which gets removed $this->assertResult( '', '' ); } function testTableIntegration() { // test custom table definition $this->assertResult( '
Cell 1
' ); $this->assertResult('
', ''); } function testChameleonIntegration() { // block in inline ins not allowed $this->assertResult( '
Not allowed!
', 'Not allowed!' ); $this->assertResult( // alt config '
Not allowed!
', '<div>Not allowed!</div>', array('Core.EscapeInvalidChildren' => true) ); // test block element that has inline content $this->assertResult( '

Not allowed!

', '

Not allowed!

' ); // stacked ins/del $this->assertResult( '

Not allowed!

', '

Not allowed!

' ); $this->assertResult( '
Allowed!
' ); } function testExclusionsIntegration() { // test exclusions $this->assertResult( 'Not allowed', '' ); } function testCustomParentIntegration() { // test inline parent $this->assertResult( 'Bold', true, array('HTML.Parent' => 'span') ); $this->assertResult( '
Reject
', 'Reject', array('HTML.Parent' => 'span') ); } function testError() { // test fallback to div $this->expectError('Cannot use unrecognized element as parent.'); $this->assertResult( '
Accept
', true, array('HTML.Parent' => 'obviously-impossible') ); $this->swallowErrors(); } function testDoubleCheckIntegration() { // breaks without the redundant checking code $this->assertResult('
', ''); // special case, prevents scrolling one back to find parent $this->assertResult('
', ''); // cascading rollbacks $this->assertResult( '
', '' ); // rollbacks twice $this->assertResult('
', ''); } }