obj = new HTMLPurifier_Strategy_RemoveForeignElements (); } public function testBlankInput() { $this->assertResult ( '' ); } public function testPreserveRecognizedElements() { $this->assertResult ( 'This is bold text.' ); } public function testRemoveForeignElements() { $this->assertResult ( 'BlingBong', 'BlingBong' ); } public function testRemoveScriptAndContents() { $this->assertResult ( '', '' ); } public function testRemoveStyleAndContents() { $this->assertResult ( '', '' ); } public function testRemoveOnlyScriptTagsLegacy() { $this->config->set ( 'Core.RemoveScriptContents', false ); $this->assertResult ( '', 'alert();' ); } public function testRemoveOnlyScriptTags() { $this->config->set ( 'Core.HiddenElements', array () ); $this->assertResult ( '', 'alert();' ); } public function testRemoveInvalidImg() { $this->assertResult ( '', '' ); } public function testPreserveValidImg() { $this->assertResult ( 'foobar.gif' ); } public function testPreserveInvalidImgWhenRemovalIsDisabled() { $this->config->set ( 'Core.RemoveInvalidImg', false ); $this->assertResult ( '' ); } public function testTextifyCommentedScriptContents() { $this->config->set ( 'HTML.Trusted', true ); $this->config->set ( 'Output.CommentScriptContents', false ); // simplify output $this->assertResult ( '', '' ); } public function testRequiredAttributesTestNotPerformedOnEndTag() { $def = $this->config->getHTMLDefinition ( true ); $def->addElement ( 'f', 'Block', 'Optional: #PCDATA', false, array ( 'req*' => 'Text' ) ); $this->assertResult ( 'Foo Bar' ); } public function testPreserveCommentsWithHTMLTrusted() { $this->config->set ( 'HTML.Trusted', true ); $this->assertResult ( '' ); } public function testRemoveTrailingHyphensInComment() { $this->config->set ( 'HTML.Trusted', true ); $this->assertResult ( '', '' ); } public function testCollapseDoubleHyphensInComment() { $this->config->set ( 'HTML.Trusted', true ); $this->assertResult ( '', '' ); } public function testPreserveCommentsWithLookup() { $this->config->set ( 'HTML.AllowedComments', array ( 'allowed' ) ); $this->assertResult ( '', '' ); } public function testPreserveCommentsWithRegexp() { $this->config->set ( 'HTML.AllowedCommentsRegexp', '/^allowed[1-9]$/' ); $this->assertResult ( '', '' ); } } // vim: et sw=4 sts=4