obj = new HTMLPurifier_Strategy_ValidateAttributes(); } function test() { // attribute order is VERY fragile, perhaps we should define // an ordering scheme! $this->assertResult(''); // test ids $this->assertResult( '
Kill the ID.
', '
Kill the ID.
' ); $this->assertResult('
Preserve the ID.
', true, array('HTML.EnableAttrID' => true)); $this->assertResult( '
Kill the ID.
', '
Kill the ID.
', array('HTML.EnableAttrID' => true) ); // test id accumulator $this->assertResult( '
Valid
Invalid
', '
Valid
Invalid
', array('HTML.EnableAttrID' => true) ); $this->assertResult( 'Bad dir.', 'Bad dir.' ); // test attribute key case sensitivity $this->assertResult( '
Convert ID to lowercase.
', '
Convert ID to lowercase.
', array('HTML.EnableAttrID' => true) ); // test simple attribute substitution $this->assertResult( '
Trim whitespace.
', '
Trim whitespace.
', array('HTML.EnableAttrID' => true) ); // test configuration id blacklist $this->assertResult( '
Invalid
', '
Invalid
', array( 'Attr.IDBlacklist' => array('invalid'), 'HTML.EnableAttrID' => true ) ); // test classes $this->assertResult('
Valid
'); $this->assertResult( '
Keep valid.
', '
Keep valid.
' ); // test title $this->assertResult( 'PHP' ); // test lang $this->assertResult( 'La soupe.', 'La soupe.' ); // test align $this->assertResult( '

Centered Headline

', '

Centered Headline

' ); // test table $this->assertResult( '
Fiddly name Super-duper-price
Carrot Humungous $500.23
Taken off the market
' ); // test URI $this->assertResult('Google'); // test invalid URI $this->assertResult( 'Google', 'Google' ); // test required attributes for img $this->assertResult( '', 'Invalid image' ); $this->assertResult( '', 'foobar.jpg' ); $this->assertResult( 'pretty picture', 'pretty picture' ); // test required attributes for bdo $this->assertResult( 'Go left.', 'Go left.' ); $this->assertResult( 'Invalid value!', 'Invalid value!' ); // comparison check for test 20 $this->assertResult( 'Invalid value!', 'Invalid value!' ); // test col.span is non-zero $this->assertResult( '', '' ); // mailto in image is not allowed $this->assertResult( '', 'Invalid image' ); } } ?>