1
0
mirror of https://github.com/ezyang/htmlpurifier.git synced 2025-08-04 13:18:00 +02:00

PSR-2 reformatting PHPDoc corrections

With minor corrections.

Signed-off-by: Marcus Bointon <marcus@synchromedia.co.uk>
Signed-off-by: Edward Z. Yang <ezyang@mit.edu>
This commit is contained in:
Marcus Bointon
2013-07-16 13:56:14 +02:00
committed by Edward Z. Yang
parent 19eee14899
commit fac747bdbd
433 changed files with 13302 additions and 6690 deletions

View File

@@ -3,41 +3,48 @@
class HTMLPurifier_Strategy_RemoveForeignElementsTest extends HTMLPurifier_StrategyHarness
{
function setUp() {
public function setUp()
{
parent::setUp();
$this->obj = new HTMLPurifier_Strategy_RemoveForeignElements();
}
function testBlankInput() {
public function testBlankInput()
{
$this->assertResult('');
}
function testPreserveRecognizedElements() {
public function testPreserveRecognizedElements()
{
$this->assertResult('This is <b>bold text</b>.');
}
function testRemoveForeignElements() {
public function testRemoveForeignElements()
{
$this->assertResult(
'<asdf>Bling</asdf><d href="bang">Bong</d><foobar />',
'BlingBong'
);
}
function testRemoveScriptAndContents() {
public function testRemoveScriptAndContents()
{
$this->assertResult(
'<script>alert();</script>',
''
);
}
function testRemoveStyleAndContents() {
public function testRemoveStyleAndContents()
{
$this->assertResult(
'<style>.foo {blink;}</style>',
''
);
}
function testRemoveOnlyScriptTagsLegacy() {
public function testRemoveOnlyScriptTagsLegacy()
{
$this->config->set('Core.RemoveScriptContents', false);
$this->assertResult(
'<script>alert();</script>',
@@ -45,7 +52,8 @@ class HTMLPurifier_Strategy_RemoveForeignElementsTest extends HTMLPurifier_Strat
);
}
function testRemoveOnlyScriptTags() {
public function testRemoveOnlyScriptTags()
{
$this->config->set('Core.HiddenElements', array());
$this->assertResult(
'<script>alert();</script>',
@@ -53,20 +61,24 @@ class HTMLPurifier_Strategy_RemoveForeignElementsTest extends HTMLPurifier_Strat
);
}
function testRemoveInvalidImg() {
public function testRemoveInvalidImg()
{
$this->assertResult('<img />', '');
}
function testPreserveValidImg() {
public function testPreserveValidImg()
{
$this->assertResult('<img src="foobar.gif" alt="foobar.gif" />');
}
function testPreserveInvalidImgWhenRemovalIsDisabled() {
public function testPreserveInvalidImgWhenRemovalIsDisabled()
{
$this->config->set('Core.RemoveInvalidImg', false);
$this->assertResult('<img />');
}
function testTextifyCommentedScriptContents() {
public function testTextifyCommentedScriptContents()
{
$this->config->set('HTML.Trusted', true);
$this->config->set('Output.CommentScriptContents', false); // simplify output
$this->assertResult(
@@ -79,33 +91,39 @@ alert(&lt;b&gt;bold&lt;/b&gt;);
);
}
function testRequiredAttributesTestNotPerformedOnEndTag() {
public function testRequiredAttributesTestNotPerformedOnEndTag()
{
$def = $this->config->getHTMLDefinition(true);
$def->addElement('f', 'Block', 'Optional: #PCDATA', false, array('req*' => 'Text'));
$this->assertResult('<f req="text">Foo</f> Bar');
}
function testPreserveCommentsWithHTMLTrusted() {
public function testPreserveCommentsWithHTMLTrusted()
{
$this->config->set('HTML.Trusted', true);
$this->assertResult('<!-- foo -->');
}
function testRemoveTrailingHyphensInComment() {
public function testRemoveTrailingHyphensInComment()
{
$this->config->set('HTML.Trusted', true);
$this->assertResult('<!-- foo ----->', '<!-- foo -->');
}
function testCollapseDoubleHyphensInComment() {
public function testCollapseDoubleHyphensInComment()
{
$this->config->set('HTML.Trusted', true);
$this->assertResult('<!-- bo --- asdf--as -->', '<!-- bo - asdf-as -->');
}
function testPreserveCommentsWithLookup() {
public function testPreserveCommentsWithLookup()
{
$this->config->set('HTML.AllowedComments', array('allowed'));
$this->assertResult('<!-- allowed --><!-- not allowed -->', '<!-- allowed -->');
}
function testPreserveCommentsWithRegexp() {
public function testPreserveCommentsWithRegexp()
{
$this->config->set('HTML.AllowedCommentsRegexp', '/^allowed[1-9]$/');
$this->assertResult('<!-- allowed1 --><!-- not allowed -->', '<!-- allowed1 -->');
}