1
0
mirror of https://github.com/ezyang/htmlpurifier.git synced 2025-08-03 20:58:11 +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,27 +3,32 @@
class HTMLPurifier_Strategy_FixNestingTest extends HTMLPurifier_StrategyHarness
{
function setUp() {
public function setUp()
{
parent::setUp();
$this->obj = new HTMLPurifier_Strategy_FixNesting();
}
function testPreserveInlineInRoot() {
public function testPreserveInlineInRoot()
{
$this->assertResult('<b>Bold text</b>');
}
function testPreserveInlineAndBlockInRoot() {
public function testPreserveInlineAndBlockInRoot()
{
$this->assertResult('<a href="about:blank">Blank</a><div>Block</div>');
}
function testRemoveBlockInInline() {
public function testRemoveBlockInInline()
{
$this->assertResult(
'<b><div>Illegal div.</div></b>',
'<b>Illegal div.</b>'
);
}
function testEscapeBlockInInline() {
public function testEscapeBlockInInline()
{
$this->config->set('Core.EscapeInvalidChildren', true);
$this->assertResult(
'<b><div>Illegal div.</div></b>',
@@ -31,60 +36,70 @@ class HTMLPurifier_Strategy_FixNestingTest extends HTMLPurifier_StrategyHarness
);
}
function testRemoveNodeWithMissingRequiredElements() {
public function testRemoveNodeWithMissingRequiredElements()
{
$this->assertResult('<ul></ul>', '');
}
function testListHandleIllegalPCDATA() {
public function testListHandleIllegalPCDATA()
{
$this->assertResult(
'<ul>Illegal text<li>Legal item</li></ul>',
'<ul><li>Illegal text</li><li>Legal item</li></ul>'
);
}
function testRemoveIllegalPCDATA() {
public function testRemoveIllegalPCDATA()
{
$this->assertResult(
'<table><tr>Illegal text<td></td></tr></table>',
'<table><tr><td></td></tr></table>'
);
}
function testCustomTableDefinition() {
public function testCustomTableDefinition()
{
$this->assertResult('<table><tr><td>Cell 1</td></tr></table>');
}
function testRemoveEmptyTable() {
public function testRemoveEmptyTable()
{
$this->assertResult('<table></table>', '');
}
function testChameleonRemoveBlockInNodeInInline() {
public function testChameleonRemoveBlockInNodeInInline()
{
$this->assertResult(
'<span><ins><div>Not allowed!</div></ins></span>',
'<span><ins>Not allowed!</ins></span>'
);
}
function testChameleonRemoveBlockInBlockNodeWithInlineContent() {
public function testChameleonRemoveBlockInBlockNodeWithInlineContent()
{
$this->assertResult(
'<h1><ins><div>Not allowed!</div></ins></h1>',
'<h1><ins>Not allowed!</ins></h1>'
);
}
function testNestedChameleonRemoveBlockInNodeWithInlineContent() {
public function testNestedChameleonRemoveBlockInNodeWithInlineContent()
{
$this->assertResult(
'<h1><ins><del><div>Not allowed!</div></del></ins></h1>',
'<h1><ins><del>Not allowed!</del></ins></h1>'
);
}
function testNestedChameleonPreserveBlockInBlock() {
public function testNestedChameleonPreserveBlockInBlock()
{
$this->assertResult(
'<div><ins><del><div>Allowed!</div></del></ins></div>'
);
}
function testChameleonEscapeInvalidBlockInInline() {
public function testChameleonEscapeInvalidBlockInInline()
{
$this->config->set('Core.EscapeInvalidChildren', true);
$this->assertResult( // alt config
'<span><ins><div>Not allowed!</div></ins></span>',
@@ -92,7 +107,8 @@ class HTMLPurifier_Strategy_FixNestingTest extends HTMLPurifier_StrategyHarness
);
}
function testExclusionsIntegration() {
public function testExclusionsIntegration()
{
// test exclusions
$this->assertResult(
'<a><span><a>Not allowed</a></span></a>',
@@ -100,17 +116,20 @@ class HTMLPurifier_Strategy_FixNestingTest extends HTMLPurifier_StrategyHarness
);
}
function testPreserveInlineNodeInInlineRootNode() {
public function testPreserveInlineNodeInInlineRootNode()
{
$this->config->set('HTML.Parent', 'span');
$this->assertResult('<b>Bold</b>');
}
function testRemoveBlockNodeInInlineRootNode() {
public function testRemoveBlockNodeInInlineRootNode()
{
$this->config->set('HTML.Parent', 'span');
$this->assertResult('<div>Reject</div>', 'Reject');
}
function testInvalidParentError() {
public function testInvalidParentError()
{
// test fallback to div
$this->config->set('HTML.Parent', 'obviously-impossible');
$this->config->set('Cache.DefinitionImpl', null);
@@ -118,28 +137,34 @@ class HTMLPurifier_Strategy_FixNestingTest extends HTMLPurifier_StrategyHarness
$this->assertResult('<div>Accept</div>');
}
function testCascadingRemovalOfNodesMissingRequiredChildren() {
public function testCascadingRemovalOfNodesMissingRequiredChildren()
{
$this->assertResult('<table><tr></tr></table>', '');
}
function testCascadingRemovalSpecialCaseCannotScrollOneBack() {
public function testCascadingRemovalSpecialCaseCannotScrollOneBack()
{
$this->assertResult('<table><tr></tr><tr></tr></table>', '');
}
function testLotsOfCascadingRemovalOfNodes() {
public function testLotsOfCascadingRemovalOfNodes()
{
$this->assertResult('<table><tbody><tr></tr><tr></tr></tbody><tr></tr><tr></tr></table>', '');
}
function testAdjacentRemovalOfNodeMissingRequiredChildren() {
public function testAdjacentRemovalOfNodeMissingRequiredChildren()
{
$this->assertResult('<table></table><table></table>', '');
}
function testStrictBlockquoteInHTML401() {
public function testStrictBlockquoteInHTML401()
{
$this->config->set('HTML.Doctype', 'HTML 4.01 Strict');
$this->assertResult('<blockquote>text</blockquote>', '<blockquote><p>text</p></blockquote>');
}
function testDisabledExcludes() {
public function testDisabledExcludes()
{
$this->config->set('Core.DisableExcludes', true);
$this->assertResult('<pre><font><font></font></font></pre>');
}