From 3af6457801654c302acdd81a0365045d959f0cff Mon Sep 17 00:00:00 2001 From: "Edward Z. Yang" Date: Mon, 6 Aug 2007 06:22:23 +0000 Subject: [PATCH] Refactor unit tests to have one logical assertion per method. - Support executing a single unit tests using __only prefix - Hook in Email classes to main code, even if they're unused git-svn-id: http://htmlpurifier.org/svnroot/htmlpurifier/trunk@1373 48356398-32a2-884e-a903-53898d9a118a --- library/HTMLPurifier/AttrDef/URI.php | 1 + library/HTMLPurifier/AttrDef/URI/Email.php | 1 + .../HTMLPurifier/AttrTransform/BdoDirTest.php | 17 +- .../AttrTransform/BgColorTest.php | 24 +- .../AttrTransform/BoolToCSSTest.php | 18 +- .../HTMLPurifier/AttrTransform/BorderTest.php | 18 +- .../AttrTransform/EnumToCSSTest.php | 42 +- .../AttrTransform/ImgRequiredTest.php | 38 +- .../AttrTransform/ImgSpaceTest.php | 24 +- tests/HTMLPurifier/AttrTransform/LangTest.php | 27 +- .../HTMLPurifier/AttrTransform/LengthTest.php | 15 +- tests/HTMLPurifier/AttrTransform/NameTest.php | 8 +- tests/HTMLPurifier/AttrTransformHarness.php | 1 + tests/HTMLPurifier/ChildDef/ChameleonTest.php | 32 +- tests/HTMLPurifier/ChildDef/OptionalTest.php | 12 +- tests/HTMLPurifier/ChildDef/RequiredTest.php | 49 +- .../ChildDef/StrictBlockquoteTest.php | 50 +- tests/HTMLPurifier/ChildDef/TableTest.php | 8 +- tests/HTMLPurifier/ChildDefHarness.php | 1 + tests/HTMLPurifier/SimpleTest/Reporter.php | 1 + tests/HTMLPurifier/Strategy/CoreTest.php | 16 +- .../HTMLPurifier/Strategy/FixNestingTest.php | 134 +++--- .../Strategy/MakeWellFormedTest.php | 86 +--- .../Strategy/RemoveForeignElementsTest.php | 106 ++--- .../Strategy/ValidateAttributesTest.php | 431 ++++-------------- tests/test_files.php | 4 + 26 files changed, 471 insertions(+), 693 deletions(-) diff --git a/library/HTMLPurifier/AttrDef/URI.php b/library/HTMLPurifier/AttrDef/URI.php index dcf9849c..365748c0 100644 --- a/library/HTMLPurifier/AttrDef/URI.php +++ b/library/HTMLPurifier/AttrDef/URI.php @@ -6,6 +6,7 @@ require_once 'HTMLPurifier/URIScheme.php'; require_once 'HTMLPurifier/URISchemeRegistry.php'; require_once 'HTMLPurifier/AttrDef/URI/Host.php'; require_once 'HTMLPurifier/PercentEncoder.php'; +require_once 'HTMLPurifier/AttrDef/URI/Email.php'; // special case filtering directives diff --git a/library/HTMLPurifier/AttrDef/URI/Email.php b/library/HTMLPurifier/AttrDef/URI/Email.php index 5a7085db..aaec099a 100644 --- a/library/HTMLPurifier/AttrDef/URI/Email.php +++ b/library/HTMLPurifier/AttrDef/URI/Email.php @@ -1,6 +1,7 @@ obj = new HTMLPurifier_AttrTransform_BdoDir(); } - function test() { - + function testAddDefaultDir() { $this->assertResult( array(), array('dir' => 'ltr') ); - - // leave existing dir alone + } + + function testPreserveExistingDir() { $this->assertResult( array('dir' => 'rtl') ); - - // use a different default + } + + function testAlternateDefault() { + $this->config->set('Attr', 'DefaultTextDir', 'rtl'); $this->assertResult( array(), - array('dir' => 'rtl'), - array('Attr.DefaultTextDir' => 'rtl') + array('dir' => 'rtl') ); } diff --git a/tests/HTMLPurifier/AttrTransform/BgColorTest.php b/tests/HTMLPurifier/AttrTransform/BgColorTest.php index 69429ad8..ac46a312 100644 --- a/tests/HTMLPurifier/AttrTransform/BgColorTest.php +++ b/tests/HTMLPurifier/AttrTransform/BgColorTest.php @@ -3,6 +3,10 @@ require_once 'HTMLPurifier/AttrTransform/BgColor.php'; require_once 'HTMLPurifier/AttrTransformHarness.php'; +// we currently rely on the CSS validator to fix any problems. +// This means that this transform, strictly speaking, supports +// a superset of the functionality. + class HTMLPurifier_AttrTransform_BgColorTest extends HTMLPurifier_AttrTransformHarness { @@ -11,31 +15,31 @@ class HTMLPurifier_AttrTransform_BgColorTest extends HTMLPurifier_AttrTransformH $this->obj = new HTMLPurifier_AttrTransform_BgColor(); } - function test() { - + function testEmptyInput() { $this->assertResult( array() ); - - // we currently rely on the CSS validator to fix any problems. - // This means that this transform, strictly speaking, supports - // a superset of the functionality. - + } + + function testBasicTransform() { $this->assertResult( array('bgcolor' => '#000000'), array('style' => 'background-color:#000000;') ); - + } + + function testPrependNewCSS() { $this->assertResult( array('bgcolor' => '#000000', 'style' => 'font-weight:bold'), array('style' => 'background-color:#000000;font-weight:bold') ); - + } + + function testLenientTreatmentOfInvalidInput() { // this may change when we natively support the datatype and // validate its contents before forwarding it on $this->assertResult( array('bgcolor' => '#F00'), array('style' => 'background-color:#F00;') ); - } } diff --git a/tests/HTMLPurifier/AttrTransform/BoolToCSSTest.php b/tests/HTMLPurifier/AttrTransform/BoolToCSSTest.php index 70b4fbdb..6c6ce40b 100644 --- a/tests/HTMLPurifier/AttrTransform/BoolToCSSTest.php +++ b/tests/HTMLPurifier/AttrTransform/BoolToCSSTest.php @@ -11,27 +11,29 @@ class HTMLPurifier_AttrTransform_BoolToCSSTest extends HTMLPurifier_AttrTransfor $this->obj = new HTMLPurifier_AttrTransform_BoolToCSS('foo', 'bar:3in;'); } - function test() { - + function testEmptyInput() { $this->assertResult( array() ); - + } + + function testBasicTransform() { $this->assertResult( array('foo' => 'foo'), array('style' => 'bar:3in;') ); - - // boolean attribute just has to be set: we don't care about - // anything else + } + + function testIgnoreValueOfBooleanAttribute() { $this->assertResult( array('foo' => 'no'), array('style' => 'bar:3in;') ); - + } + + function testPrependCSS() { $this->assertResult( array('foo' => 'foo', 'style' => 'background-color:#F00;'), array('style' => 'bar:3in;background-color:#F00;') ); - } } diff --git a/tests/HTMLPurifier/AttrTransform/BorderTest.php b/tests/HTMLPurifier/AttrTransform/BorderTest.php index 25fb3c66..a89c3b3d 100644 --- a/tests/HTMLPurifier/AttrTransform/BorderTest.php +++ b/tests/HTMLPurifier/AttrTransform/BorderTest.php @@ -12,27 +12,29 @@ class HTMLPurifier_AttrTransform_BorderTest extends HTMLPurifier_AttrTransformHa $this->obj = new HTMLPurifier_AttrTransform_Border(); } - function test() { - + function testEmptyInput() { $this->assertResult( array() ); - + } + + function testBasicTransform() { $this->assertResult( array('border' => '1'), array('style' => 'border:1px solid;') ); - - // once again, no validation done here, we expect CSS validator - // to catch it + } + + function testLenientTreatmentOfInvalidInput() { $this->assertResult( array('border' => '10%'), array('style' => 'border:10%px solid;') ); - + } + + function testPrependNewCSS() { $this->assertResult( array('border' => '23', 'style' => 'font-weight:bold;'), array('style' => 'border:23px solid;font-weight:bold;') ); - } } diff --git a/tests/HTMLPurifier/AttrTransform/EnumToCSSTest.php b/tests/HTMLPurifier/AttrTransform/EnumToCSSTest.php index 38bc0f14..6bb013f0 100644 --- a/tests/HTMLPurifier/AttrTransform/EnumToCSSTest.php +++ b/tests/HTMLPurifier/AttrTransform/EnumToCSSTest.php @@ -6,38 +6,44 @@ require_once 'HTMLPurifier/AttrTransformHarness.php'; class HTMLPurifier_AttrTransform_EnumToCSSTest extends HTMLPurifier_AttrTransformHarness { - function testRegular() { - + function setUp() { + parent::setUp(); $this->obj = new HTMLPurifier_AttrTransform_EnumToCSS('align', array( 'left' => 'text-align:left;', 'right' => 'text-align:right;' )); - - // leave empty arrays alone + } + + function testEmptyInput() { $this->assertResult( array() ); - - // leave arrays without interesting stuff alone + } + + function testPreserveArraysWithoutInterestingAttributes() { $this->assertResult( array('style' => 'font-weight:bold;') ); - - // test each of the conversions - + } + + function testConvertAlignLeft() { $this->assertResult( array('align' => 'left'), array('style' => 'text-align:left;') ); - + } + + function testConvertAlignRight() { $this->assertResult( array('align' => 'right'), array('style' => 'text-align:right;') ); - - // drop garbage value + } + + function testRemoveInvalidAlign() { $this->assertResult( array('align' => 'invalid'), array() ); - - // test CSS munging + } + + function testPrependNewCSS() { $this->assertResult( array('align' => 'left', 'style' => 'font-weight:bold;'), array('style' => 'text-align:left;font-weight:bold;') @@ -46,31 +52,23 @@ class HTMLPurifier_AttrTransform_EnumToCSSTest extends HTMLPurifier_AttrTransfor } function testCaseInsensitive() { - $this->obj = new HTMLPurifier_AttrTransform_EnumToCSS('align', array( 'right' => 'text-align:right;' )); - - // test case insensitivity $this->assertResult( array('align' => 'RIGHT'), array('style' => 'text-align:right;') ); - } function testCaseSensitive() { - $this->obj = new HTMLPurifier_AttrTransform_EnumToCSS('align', array( 'right' => 'text-align:right;' ), true); - - // test case insensitivity $this->assertResult( array('align' => 'RIGHT'), array() ); - } } diff --git a/tests/HTMLPurifier/AttrTransform/ImgRequiredTest.php b/tests/HTMLPurifier/AttrTransform/ImgRequiredTest.php index b1d871b4..5746f8d6 100644 --- a/tests/HTMLPurifier/AttrTransform/ImgRequiredTest.php +++ b/tests/HTMLPurifier/AttrTransform/ImgRequiredTest.php @@ -11,39 +11,37 @@ class HTMLPurifier_AttrTransform_ImgRequiredTest extends HTMLPurifier_AttrTransf $this->obj = new HTMLPurifier_AttrTransform_ImgRequired(); } - function test() { - + function testAddMissingAttr() { + $this->config->set('Core', 'RemoveInvalidImg', false); $this->assertResult( array(), - array('src' => '', 'alt' => 'Invalid image'), - array( - 'Core.RemoveInvalidImg' => false - ) + array('src' => '', 'alt' => 'Invalid image') ); - + } + + function testAlternateDefaults() { + $this->config->set('Attr', 'DefaultInvalidImage', 'blank.png'); + $this->config->set('Attr', 'DefaultInvalidImageAlt', 'Pawned!'); + $this->config->set('Core', 'RemoveInvalidImg', false); $this->assertResult( array(), - array('src' => 'blank.png', 'alt' => 'Pawned!'), - array( - 'Attr.DefaultInvalidImage' => 'blank.png', - 'Attr.DefaultInvalidImageAlt' => 'Pawned!', - 'Core.RemoveInvalidImg' => false - ) + array('src' => 'blank.png', 'alt' => 'Pawned!') ); - + } + + function testGenerateAlt() { $this->assertResult( array('src' => '/path/to/foobar.png'), array('src' => '/path/to/foobar.png', 'alt' => 'foobar.png') ); - + } + + function testAddDefaultSrc() { + $this->config->set('Core', 'RemoveInvalidImg', false); $this->assertResult( array('alt' => 'intrigue'), - array('alt' => 'intrigue', 'src' => ''), - array( - 'Core.RemoveInvalidImg' => false - ) + array('alt' => 'intrigue', 'src' => '') ); - } } diff --git a/tests/HTMLPurifier/AttrTransform/ImgSpaceTest.php b/tests/HTMLPurifier/AttrTransform/ImgSpaceTest.php index 8fc9178f..a40fc32c 100644 --- a/tests/HTMLPurifier/AttrTransform/ImgSpaceTest.php +++ b/tests/HTMLPurifier/AttrTransform/ImgSpaceTest.php @@ -9,33 +9,35 @@ class HTMLPurifier_AttrTransform_ImgSpaceTest extends HTMLPurifier_AttrTransform function setUp() { parent::setUp(); + $this->obj = new HTMLPurifier_AttrTransform_ImgSpace('vspace'); } - function testVertical() { - - $this->obj = new HTMLPurifier_AttrTransform_ImgSpace('vspace'); - + function testEmptyInput() { $this->assertResult( array() ); - + } + + function testVerticalBasicUsage() { $this->assertResult( array('vspace' => '1'), array('style' => 'margin-top:1px;margin-bottom:1px;') ); - - // no validation done here, we expect CSS validator to catch it + } + + function testLenientHandlingOfInvalidInput() { $this->assertResult( array('vspace' => '10%'), array('style' => 'margin-top:10%px;margin-bottom:10%px;') ); - + } + + function testPrependNewCSS() { $this->assertResult( array('vspace' => '23', 'style' => 'font-weight:bold;'), array('style' => 'margin-top:23px;margin-bottom:23px;font-weight:bold;') ); - } - function testHorizontal() { + function testHorizontalBasicUsage() { $this->obj = new HTMLPurifier_AttrTransform_ImgSpace('hspace'); $this->assertResult( array('hspace' => '1'), @@ -43,7 +45,7 @@ class HTMLPurifier_AttrTransform_ImgSpaceTest extends HTMLPurifier_AttrTransform ); } - function testInvalid() { + function testInvalidConstructionParameter() { $this->expectError('ispace is not valid space attribute'); $this->obj = new HTMLPurifier_AttrTransform_ImgSpace('ispace'); $this->assertResult( diff --git a/tests/HTMLPurifier/AttrTransform/LangTest.php b/tests/HTMLPurifier/AttrTransform/LangTest.php index 42232ca3..89ae84be 100644 --- a/tests/HTMLPurifier/AttrTransform/LangTest.php +++ b/tests/HTMLPurifier/AttrTransform/LangTest.php @@ -13,35 +13,36 @@ class HTMLPurifier_AttrTransform_LangTest $this->obj = new HTMLPurifier_AttrTransform_Lang(); } - function test() { - - // leave non-lang'ed elements alone - $this->assertResult(array(), true); - - // copy lang to xml:lang + function testEmptyInput() { + $this->assertResult(array()); + } + + function testCopyLangToXMLLang() { $this->assertResult( array('lang' => 'en'), array('lang' => 'en', 'xml:lang' => 'en') ); - - // preserve attributes + } + + function testPreserveAttributes() { $this->assertResult( array('src' => 'vert.png', 'lang' => 'fr'), array('src' => 'vert.png', 'lang' => 'fr', 'xml:lang' => 'fr') ); - - // copy xml:lang to lang + } + + function testCopyXMLLangToLang() { $this->assertResult( array('xml:lang' => 'en'), array('xml:lang' => 'en', 'lang' => 'en') ); - - // both set, override lang with xml:lang + } + + function testXMLLangOverridesLang() { $this->assertResult( array('lang' => 'fr', 'xml:lang' => 'de'), array('lang' => 'de', 'xml:lang' => 'de') ); - } } diff --git a/tests/HTMLPurifier/AttrTransform/LengthTest.php b/tests/HTMLPurifier/AttrTransform/LengthTest.php index 62068e4b..8d2265f3 100644 --- a/tests/HTMLPurifier/AttrTransform/LengthTest.php +++ b/tests/HTMLPurifier/AttrTransform/LengthTest.php @@ -11,21 +11,32 @@ class HTMLPurifier_AttrTransform_LengthTest extends HTMLPurifier_AttrTransformHa $this->obj = new HTMLPurifier_AttrTransform_Length('width'); } - function test() { + function testEmptyInput() { $this->assertResult( array() ); + } + + function testTransformPixel() { $this->assertResult( array('width' => '10'), array('style' => 'width:10px;') ); + } + + function testTransformPercentage() { $this->assertResult( array('width' => '10%'), array('style' => 'width:10%;') ); + } + + function testPrependNewCSS() { $this->assertResult( array('width' => '10%', 'style' => 'font-weight:bold'), array('style' => 'width:10%;font-weight:bold') ); - // this behavior might change + } + + function testLenientTreatmentOfInvalidInput() { $this->assertResult( array('width' => 'asdf'), array('style' => 'width:asdf;') diff --git a/tests/HTMLPurifier/AttrTransform/NameTest.php b/tests/HTMLPurifier/AttrTransform/NameTest.php index 30e9e58b..fef690d1 100644 --- a/tests/HTMLPurifier/AttrTransform/NameTest.php +++ b/tests/HTMLPurifier/AttrTransform/NameTest.php @@ -11,12 +11,18 @@ class HTMLPurifier_AttrTransform_NameTest extends HTMLPurifier_AttrTransformHarn $this->obj = new HTMLPurifier_AttrTransform_Name(); } - function test() { + function testEmpty() { $this->assertResult( array() ); + } + + function testTransformNameToID() { $this->assertResult( array('name' => 'free'), array('id' => 'free') ); + } + + function testExistingIDOverridesName() { $this->assertResult( array('name' => 'tryit', 'id' => 'tobad'), array('id' => 'tobad') diff --git a/tests/HTMLPurifier/AttrTransformHarness.php b/tests/HTMLPurifier/AttrTransformHarness.php index e6ae1a93..0aa13a53 100644 --- a/tests/HTMLPurifier/AttrTransformHarness.php +++ b/tests/HTMLPurifier/AttrTransformHarness.php @@ -6,6 +6,7 @@ class HTMLPurifier_AttrTransformHarness extends HTMLPurifier_ComplexHarness { function setUp() { + parent::setUp(); $this->func = 'transform'; } diff --git a/tests/HTMLPurifier/ChildDef/ChameleonTest.php b/tests/HTMLPurifier/ChildDef/ChameleonTest.php index 676bbe48..a54d5fb2 100644 --- a/tests/HTMLPurifier/ChildDef/ChameleonTest.php +++ b/tests/HTMLPurifier/ChildDef/ChameleonTest.php @@ -6,28 +6,36 @@ require_once 'HTMLPurifier/ChildDef/Chameleon.php'; class HTMLPurifier_ChildDef_ChameleonTest extends HTMLPurifier_ChildDefHarness { - function test() { - + var $isInline; + + function setUp() { + parent::setUp(); $this->obj = new HTMLPurifier_ChildDef_Chameleon( 'b | i', // allowed only when in inline context 'b | i | div' // allowed only when in block context ); - + $this->context->register('IsInline', $this->isInline); + } + + function testInlineAlwaysAllowed() { + $this->isInline = true; $this->assertResult( - 'Allowed.', true, - array(), array('IsInline' => true) + 'Allowed.' ); - + } + + function testBlockNotAllowedInInline() { + $this->isInline = true; $this->assertResult( - '
Not allowed.
', '', - array(), array('IsInline' => true) + '
Not allowed.
', '' ); - + } + + function testBlockAllowedInNonInline() { + $this->isInline = false; $this->assertResult( - '
Allowed.
', true, - array(), array('IsInline' => false) + '
Allowed.
' ); - } } diff --git a/tests/HTMLPurifier/ChildDef/OptionalTest.php b/tests/HTMLPurifier/ChildDef/OptionalTest.php index bdb5ac05..154353df 100644 --- a/tests/HTMLPurifier/ChildDef/OptionalTest.php +++ b/tests/HTMLPurifier/ChildDef/OptionalTest.php @@ -6,13 +6,17 @@ require_once 'HTMLPurifier/ChildDef/Optional.php'; class HTMLPurifier_ChildDef_OptionalTest extends HTMLPurifier_ChildDefHarness { - function test() { - + function setUp() { + parent::setUp(); $this->obj = new HTMLPurifier_ChildDef_Optional('b | i'); - + } + + function testBasicUsage() { $this->assertResult('Bold text', 'Bold text'); + } + + function testRemoveForbiddenText() { $this->assertResult('Not allowed text', ''); - } } diff --git a/tests/HTMLPurifier/ChildDef/RequiredTest.php b/tests/HTMLPurifier/ChildDef/RequiredTest.php index e708abea..f2b55bae 100644 --- a/tests/HTMLPurifier/ChildDef/RequiredTest.php +++ b/tests/HTMLPurifier/ChildDef/RequiredTest.php @@ -6,8 +6,7 @@ require_once 'HTMLPurifier/ChildDef/Required.php'; class HTMLPurifier_ChildDef_RequiredTest extends HTMLPurifier_ChildDefHarness { - function testParsing() { - + function testPrepareString() { $def = new HTMLPurifier_ChildDef_Required('foobar | bang |gizmo'); $this->assertIdentical($def->elements, array( @@ -15,51 +14,61 @@ class HTMLPurifier_ChildDef_RequiredTest extends HTMLPurifier_ChildDefHarness ,'bang' => true ,'gizmo' => true )); - + } + + function testPrepareArray() { $def = new HTMLPurifier_ChildDef_Required(array('href', 'src')); $this->assertIdentical($def->elements, array( 'href' => true ,'src' => true )); - } - function testPCDATAForbidden() { - + function setUp() { + parent::setUp(); $this->obj = new HTMLPurifier_ChildDef_Required('dt | dd'); - + } + + function testEmptyInput() { $this->assertResult('', false); + } + + function testRemoveIllegalTagsAndElements() { $this->assertResult( '
Term
Text in an illegal location'. '
Definition
Illegal tag', '
Term
Definition
'); $this->assertResult('How do you do!', false); - + } + + function testIgnoreWhitespace() { // whitespace shouldn't trigger it $this->assertResult("\n
Definition
"); - + } + + function testPreserveWhitespaceAfterRemoval() { $this->assertResult( '
Definition
', '
Definition
' ); + } + + function testDeleteNodeIfOnlyWhitespace() { $this->assertResult("\t ", false); - } function testPCDATAAllowed() { - $this->obj = new HTMLPurifier_ChildDef_Required('#PCDATA | b'); - - $this->assertResult('Bold text', 'Bold text'); - - // with child escaping on + $this->assertResult('Out Bold text', 'Out Bold text'); + } + + function testPCDATAAllowedWithEscaping() { + $this->obj = new HTMLPurifier_ChildDef_Required('#PCDATA | b'); + $this->config->set('Core', 'EscapeInvalidChildren', true); $this->assertResult( - 'Bold text', - 'Bold text<img />', - array( - 'Core.EscapeInvalidChildren' => true - ) + 'Out Bold text', + 'Out Bold text<img />' ); } diff --git a/tests/HTMLPurifier/ChildDef/StrictBlockquoteTest.php b/tests/HTMLPurifier/ChildDef/StrictBlockquoteTest.php index dd00bfa8..788c7a36 100644 --- a/tests/HTMLPurifier/ChildDef/StrictBlockquoteTest.php +++ b/tests/HTMLPurifier/ChildDef/StrictBlockquoteTest.php @@ -7,48 +7,76 @@ class HTMLPurifier_ChildDef_StrictBlockquoteTest extends HTMLPurifier_ChildDefHarness { - function test() { - + function setUp() { + parent::setUp(); $this->obj = new HTMLPurifier_ChildDef_StrictBlockquote('div | p'); - - // assuming default wrap is p - + } + + function testEmptyInput() { $this->assertResult(''); + } + + function testPreserveValidP() { $this->assertResult('

Valid

'); + } + + function testPreserveValidDiv() { $this->assertResult('
Still valid
'); + } + + function testWrapTextWithP() { $this->assertResult('Needs wrap', '

Needs wrap

'); + } + + function testNoWrapForWhitespaceOrValidElements() { $this->assertResult('

Do not wrap

Whitespace

'); + } + + function testWrapTextNextToValidElements() { $this->assertResult( 'Wrap'. '

Do not wrap

', '

Wrap

Do not wrap

' ); + } + + function testWrapInlineElements() { $this->assertResult( '

Do not

'.'Wrap', '

Do not

Wrap

' ); + } + + function testWrapAndRemoveInvalidTags() { $this->assertResult( '
  • Not allowed
  • Paragraph.

    Hmm.

    ', '

    Not allowedParagraph.

    Hmm.

    ' ); + } + + function testWrapComplicatedSring() { $this->assertResult( $var = 'He said
    perhaps
    we should nuke them.', "

    $var

    " ); + } + + function testWrapAndRemoveInvalidTagsComplex() { $this->assertResult( 'BarPeopleConniving.'. '

    Fools!

    ', '

    Bar'. 'PeopleConniving.

    Fools!

    ' ); - - $this->assertResult('Needs wrap', '
    Needs wrap
    ', - array('HTML.BlockWrapper' => 'div')); + } + + function testAlternateWrapper() { + $this->config->set('HTML', 'BlockWrapper', 'div'); + $this->assertResult('Needs wrap', '
    Needs wrap
    '); } function testError() { $this->obj = new HTMLPurifier_ChildDef_StrictBlockquote('div | p'); - $this->assertResult('Needs wrap', '

    Needs wrap

    ', - array('HTML.BlockWrapper' => 'dav')); - $this->swallowErrors(); + $this->config->set('HTML', 'BlockWrapper', 'dav'); + $this->assertResult('Needs wrap', '

    Needs wrap

    '); } } diff --git a/tests/HTMLPurifier/ChildDef/TableTest.php b/tests/HTMLPurifier/ChildDef/TableTest.php index 466ca6ee..209e2a57 100644 --- a/tests/HTMLPurifier/ChildDef/TableTest.php +++ b/tests/HTMLPurifier/ChildDef/TableTest.php @@ -6,10 +6,12 @@ require_once 'HTMLPurifier/ChildDef/Table.php'; class HTMLPurifier_ChildDef_TableTest extends HTMLPurifier_ChildDefHarness { - function test() { - + function setUp() { + parent::setUp(); $this->obj = new HTMLPurifier_ChildDef_Table(); - + } + + function test() { $this->assertResult('', false); // we're using empty tags to compact the tests: under real circumstances diff --git a/tests/HTMLPurifier/ChildDefHarness.php b/tests/HTMLPurifier/ChildDefHarness.php index b0acb0bf..0650c2d0 100644 --- a/tests/HTMLPurifier/ChildDefHarness.php +++ b/tests/HTMLPurifier/ChildDefHarness.php @@ -7,6 +7,7 @@ class HTMLPurifier_ChildDefHarness extends HTMLPurifier_ComplexHarness { function setUp() { + parent::setUp(); $this->obj = null; $this->func = 'validateChildren'; $this->to_tokens = true; diff --git a/tests/HTMLPurifier/SimpleTest/Reporter.php b/tests/HTMLPurifier/SimpleTest/Reporter.php index c3b7a5f4..5f01d804 100644 --- a/tests/HTMLPurifier/SimpleTest/Reporter.php +++ b/tests/HTMLPurifier/SimpleTest/Reporter.php @@ -16,6 +16,7 @@ class HTMLPurifier_SimpleTest_Reporter extends HTMLReporter ?>> + /> obj = new HTMLPurifier_Strategy_Core(); } - function test() { - + function testBlankInput() { $this->assertResult(''); + } + + function testMakeWellFormed() { $this->assertResult( 'Make well formed.', 'Make well formed.' ); + } + + function testFixNesting() { $this->assertResult( '
    Fix nesting.
    ', '
    Fix nesting.
    ' ); + } + + function testRemoveForeignElements() { $this->assertResult( 'Foreign element removal.', 'Foreign element removal.' ); + } + + function testFirstThree() { $this->assertResult( '
    All three.
    ', '
    All three.
    ' ); - } } diff --git a/tests/HTMLPurifier/Strategy/FixNestingTest.php b/tests/HTMLPurifier/Strategy/FixNestingTest.php index ac651684..6022fcd6 100644 --- a/tests/HTMLPurifier/Strategy/FixNestingTest.php +++ b/tests/HTMLPurifier/Strategy/FixNestingTest.php @@ -11,79 +11,81 @@ class HTMLPurifier_Strategy_FixNestingTest extends HTMLPurifier_StrategyHarness $this->obj = new HTMLPurifier_Strategy_FixNesting(); } - function testBlockAndInlineIntegration() { - - // legal inline + function testPreserveInlineInRoot() { $this->assertResult('Bold text'); - - // legal inline and block (default parent element is FLOW) + } + + function testPreserveInlineAndBlockInRoot() { $this->assertResult('Blank
    Block
    '); - - // illegal block in inline + } + + function testRemoveBlockInInline() { $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 + function testEscapeBlockInInline() { + $this->config->set('Core', 'EscapeInvalidChildren', true); + $this->assertResult( + '
    Illegal div.
    ', + '<div>Illegal div.</div>' + ); + } + + function testRemoveNodeWithMissingRequiredElements() { $this->assertResult('
      ', ''); - - // test illegal text which gets removed + } + + function testRemoveIllegalPCDATA() { $this->assertResult( '
        Illegal text
      • Legal item
      ', '
      • Legal item
      ' ); - } - function testTableIntegration() { - // test custom table definition - $this->assertResult( - '
      Cell 1
      ' - ); + function testCustomTableDefinition() { + $this->assertResult('
      Cell 1
      '); + } + + function testRemoveEmptyTable() { $this->assertResult('
      ', ''); } - function testChameleonIntegration() { - - // block in inline ins not allowed + function testChameleonRemoveBlockInNodeInInline() { $this->assertResult( '
      Not allowed!
      ', 'Not allowed!' ); - - // test block element that has inline content + } + + function testChameleonRemoveBlockInBlockNodeWithInlineContent() { $this->assertResult( '

      Not allowed!

      ', '

      Not allowed!

      ' ); - - // stacked ins/del + } + + function testNestedChameleonRemoveBlockInNodeWithInlineContent() { $this->assertResult( '

      Not allowed!

      ', '

      Not allowed!

      ' ); + } + + function testNestedChameleonPreserveBlockInBlock() { $this->assertResult( '
      Allowed!
      ' ); - + } + + function testChameleonEscapeInvalidBlockInInline() { + $this->config->set('Core', 'EscapeInvalidChildren', true); $this->assertResult( // alt config '
      Not allowed!
      ', - '<div>Not allowed!</div>', - array('Core.EscapeInvalidChildren' => true) + '<div>Not allowed!</div>' ); - } function testExclusionsIntegration() { @@ -93,41 +95,37 @@ class HTMLPurifier_Strategy_FixNestingTest extends HTMLPurifier_StrategyHarness '' ); } - - 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 testPreserveInlineNodeInInlineRootNode() { + $this->config->set('HTML', 'Parent', 'span'); + $this->assertResult('Bold'); } - function testDoubleCheckIntegration() { - // breaks without the redundant checking code + function testRemoveBlockNodeInInlineRootNode() { + $this->config->set('HTML', 'Parent', 'span'); + $this->assertResult('
      Reject
      ', 'Reject'); + } + + function testInvalidParentError() { + // test fallback to div + $this->config->set('HTML', 'Parent', 'obviously-impossible'); + $this->expectError('Cannot use unrecognized element as parent.'); + $this->assertResult('
      Accept
      '); + } + + function testCascadingRemovalOfNodesMissingRequiredChildren() { $this->assertResult('
      ', ''); - - // special case, prevents scrolling one back to find parent + } + + function testCascadingRemovalSpecialCaseCannotScrollOneBack() { $this->assertResult('
      ', ''); - - // cascading rollbacks - $this->assertResult( - '
      ', - '' - ); - - // rollbacks twice + } + + function testLotsOfCascadingRemovalOfNodes() { + $this->assertResult('
      ', ''); + } + + function testAdjacentRemovalOfNodeMissingRequiredChildren() { $this->assertResult('
      ', ''); } diff --git a/tests/HTMLPurifier/Strategy/MakeWellFormedTest.php b/tests/HTMLPurifier/Strategy/MakeWellFormedTest.php index 5a1cca99..a227d6a7 100644 --- a/tests/HTMLPurifier/Strategy/MakeWellFormedTest.php +++ b/tests/HTMLPurifier/Strategy/MakeWellFormedTest.php @@ -9,113 +9,77 @@ class HTMLPurifier_Strategy_MakeWellFormedTest extends HTMLPurifier_StrategyHarn function setUp() { parent::setUp(); $this->obj = new HTMLPurifier_Strategy_MakeWellFormed(); - $this->config = array(); } - function testNormalIntegration() { + function testEmptyInput() { $this->assertResult(''); + } + + function testWellFormedInput() { $this->assertResult('This is bold text.'); } - function testUnclosedTagIntegration() { + function testUnclosedTagTerminatedByDocumentEnd() { $this->assertResult( 'Unclosed tag, gasp!', 'Unclosed tag, gasp!' ); - + } + + function testUnclosedTagTerminatedByParentNodeEnd() { $this->assertResult( 'Bold and italic?', 'Bold and italic?' ); - + } + + function testRemoveStrayClosingTag() { $this->assertResult( 'Unused end tags... recycle!', 'Unused end tags... recycle!' ); } - function testEmptyTagDetectionIntegration() { + function testConvertStartToEmpty() { $this->assertResult( '
      ', '
      ' ); - + } + + function testConvertEmptyToStart() { $this->assertResult( '
      ', '
      ' ); } - function testAutoClose() { - // paragraph - + function testAutoCloseParagraph() { $this->assertResult( '

      Paragraph 1

      Paragraph 2', '

      Paragraph 1

      Paragraph 2

      ' ); - + } + + function testAutoCloseParagraphInsideDiv() { $this->assertResult( '

      Paragraphs

      In

      A

      Div

      ', '

      Paragraphs

      In

      A

      Div

      ' ); - - // list - + } + + function testAutoCloseListItem() { $this->assertResult( '
      1. Item 1
      2. Item 2
      ', '
      1. Item 1
      2. Item 2
      ' ); - - // colgroup - + } + + function testAutoCloseColgroup() { $this->assertResult( '
      ', '
      ' ); - - } - - function testMultipleInjectors() { - - $this->config = array('AutoFormat.AutoParagraph' => true, 'AutoFormat.Linkify' => true); - - $this->assertResult( - 'Foobar', - '

      Foobar

      ' - ); - - $this->assertResult( - 'http://example.com', - '

      http://example.com

      ' - ); - - $this->assertResult( - 'http://example.com', - '

      http://example.com

      ' - ); - - $this->assertResult( - 'http://example.com', - '

      http://example.com

      ' - ); - - $this->assertResult( -'http://example.com - -http://dev.example.com', - '

      http://example.com

      http://dev.example.com

      ' - ); - - $this->assertResult( - 'http://example.com
      http://example.com
      ', - '

      http://example.com

      ' - ); - - $this->assertResult( - 'This URL http://example.com is what you need', - '

      This URL http://example.com is what you need

      ' - ); - } } diff --git a/tests/HTMLPurifier/Strategy/RemoveForeignElementsTest.php b/tests/HTMLPurifier/Strategy/RemoveForeignElementsTest.php index 87a4b38c..19a37b24 100644 --- a/tests/HTMLPurifier/Strategy/RemoveForeignElementsTest.php +++ b/tests/HTMLPurifier/Strategy/RemoveForeignElementsTest.php @@ -3,8 +3,7 @@ require_once 'HTMLPurifier/StrategyHarness.php'; require_once 'HTMLPurifier/Strategy/RemoveForeignElements.php'; -class HTMLPurifier_Strategy_RemoveForeignElementsTest - extends HTMLPurifier_StrategyHarness +class HTMLPurifier_Strategy_RemoveForeignElementsTest extends HTMLPurifier_StrategyHarness { function setUp() { @@ -12,96 +11,75 @@ class HTMLPurifier_Strategy_RemoveForeignElementsTest $this->obj = new HTMLPurifier_Strategy_RemoveForeignElements(); } - function test() { - - $this->config = array('HTML.Doctype' => 'XHTML 1.0 Strict'); - + function testBlankInput() { $this->assertResult(''); - + } + + function testPreserveRecognizedElements() { $this->assertResult('This is bold text.'); - + } + + function testRemoveForeignElements() { $this->assertResult( 'BlingBong', 'BlingBong' ); - + } + + function testRemoveScriptAndContents() { $this->assertResult( '', '' ); - + } + + function testRemoveStyleAndContents() { $this->assertResult( '', '' ); - + } + + function testRemoveOnlyScriptTagsLegacy() { + $this->config->set('Core', 'RemoveScriptContents', false); $this->assertResult( '', - 'alert();', - array('Core.RemoveScriptContents' => false) + 'alert();' ); - + } + + function testRemoveOnlyScriptTags() { + $this->config->set('Core', 'HiddenElements', array()); $this->assertResult( '', - 'alert();', - array('Core.HiddenElements' => array()) + 'alert();' ); - - $this->assertResult( - '
    • Item 1
    • ', - '
      • Item 1
      ' - ); - - // test center transform - $this->assertResult( - '
      Look I am Centered!
      ', - '
      Look I am Centered!
      ' - ); - - // test font transform - $this->assertResult( - 'Big Warning!', - 'Big'. - ' Warning!' - ); - - // test removal of invalid img tag - $this->assertResult( - '', - '' - ); - - // test preservation of valid img tag + } + + function testRemoveInvalidImg() { + $this->assertResult('', ''); + } + + function testPreserveValidImg() { $this->assertResult('foobar.gif'); - - // test preservation of invalid img tag when removal is disabled - $this->assertResult( - '', - true, - array( - 'Core.RemoveInvalidImg' => false - ) - ); - - // test transform to unallowed element - $this->assertResult( - 'Big Warning!', - 'Big Warning!', - array('HTML.Allowed' => 'div') - ); - - // text-ify commented script contents ( the trailing comment gets - // removed during generation ) + } + + function testPreserveInvalidImgWhenRemovalIsDisabled() { + $this->config->set('Core', 'RemoveInvalidImg', false); + $this->assertResult(''); + } + + function testTextifyCommentedScriptContents() { + $this->config->set('HTML', 'Trusted', true); + $this->config->set('Output', 'CommentScriptContents', false); // simplify output $this->assertResult( '', '', - array('HTML.Trusted' => true, 'Output.CommentScriptContents' => false) +// ' ); - } } diff --git a/tests/HTMLPurifier/Strategy/ValidateAttributesTest.php b/tests/HTMLPurifier/Strategy/ValidateAttributesTest.php index fc7de460..25359425 100644 --- a/tests/HTMLPurifier/Strategy/ValidateAttributesTest.php +++ b/tests/HTMLPurifier/Strategy/ValidateAttributesTest.php @@ -1,6 +1,5 @@ obj = new HTMLPurifier_Strategy_ValidateAttributes(); - $this->config = array('HTML.Doctype' => 'XHTML 1.0 Strict'); } - function testEmpty() { + function testEmptyInput() { $this->assertResult(''); } - function testIDs() { + function testRemoveIDByDefault() { $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) - ); - + } + + function testRemoveInvalidDir() { $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 - ) - ); - - // name rewritten as id - $this->assertResult( - '', - '', - array('HTML.EnableAttrID' => true) - ); } - function testClasses() { + function testPreserveValidClass() { $this->assertResult('
      Valid
      '); - + } + + function testSelectivelyRemoveInvalidClasses() { $this->assertResult( '
      Keep valid.
      ', '
      Keep valid.
      ' ); } - function testTitle() { + function testPreserveTitle() { $this->assertResult( 'PHP' ); } - function testLang() { + function testAddXMLLang() { $this->assertResult( 'La soupe.', 'La soupe.' ); - - // test only xml:lang for XHTML 1.1 + } + + function testOnlyXMLLangInXHTML11() { + $this->config->set('HTML', 'Doctype', 'XHTML 1.1'); $this->assertResult( 'asdf', - 'asdf', array('HTML.Doctype' => 'XHTML 1.1') + 'asdf' ); } - function testAlign() { - - $this->assertResult( - '

      Centered Headline

      ', - '

      Centered Headline

      ' - ); - $this->assertResult( - '

      Right-aligned Headline

      ', - '

      Right-aligned Headline

      ' - ); - $this->assertResult( - '

      Left-aligned Headline

      ', - '

      Left-aligned Headline

      ' - ); - $this->assertResult( - '

      Justified Paragraph

      ', - '

      Justified Paragraph

      ' - ); - $this->assertResult( - '

      Invalid Headline

      ', - '

      Invalid Headline

      ' - ); - + function testBasicURI() { + $this->assertResult('
      Google'); } - function testTable() { + function testInvalidURI() { + $this->assertResult( + 'Google', + 'Google' + ); + } + + function testBdoAddMissingDir() { + $this->assertResult( + 'Go left.', + 'Go left.' + ); + } + + function testBdoReplaceInvalidDirWithDefault() { + $this->assertResult( + 'Invalid value!', + 'Invalid value!' + ); + } + + function testBdoAlternateDefaultDir() { + $this->config->set('Attr', 'DefaultTextDir', 'rtl'); + $this->assertResult( + 'Go right.', + 'Go right.' + ); + } + + function testRemoveDirWhenNotRequired() { + $this->assertResult( + 'Invalid value!', + 'Invalid value!' + ); + } + + function testTableAttributes() { $this->assertResult( '@@ -148,293 +120,64 @@ class HTMLPurifier_Strategy_ValidateAttributesTest extends
      ' ); - - // test col.span is non-zero + } + + function testColSpanIsNonZero() { $this->assertResult( '', '' ); - // lengths - $this->assertResult( - '
      ', - '
      ' - ); - // td boolean transformation - $this->assertResult( - '', - '' - ); - - // caption align transformation - $this->assertResult( - '', - '' - ); - $this->assertResult( - '', - '' - ); - $this->assertResult( - '', - '' - ); - $this->assertResult( - '', - '' - ); - $this->assertResult( - '', - '' - ); - - // align transformation - $this->assertResult( - '', - '
      ' - ); - $this->assertResult( - '
      ', - '
      ' - ); - $this->assertResult( - '
      ', - '
      ' - ); - $this->assertResult( - '
      ', - '
      ' - ); } - function testURI() { - $this->assertResult('Google'); - - // test invalid URI - $this->assertResult( - 'Google', - 'Google' - ); - } - - function testImg() { + function testImgAddDefaults() { + $this->config->set('Core', 'RemoveInvalidImg', false); $this->assertResult( '', - 'Invalid image', - array('Core.RemoveInvalidImg' => false) + 'Invalid image' ); - + } + + function testImgGenerateAlt() { $this->assertResult( '', 'foobar.jpg' ); - + } + + function testImgAddDefaultSrc() { + $this->config->set('Core', 'RemoveInvalidImg', false); $this->assertResult( 'pretty picture', - 'pretty picture', - array('Core.RemoveInvalidImg' => false) + 'pretty picture' ); - // mailto in image is not allowed + } + + function testImgRemoveNonRetrievableProtocol() { + $this->config->set('Core', 'RemoveInvalidImg', false); $this->assertResult( '', - 'mailto:foo@example.com', - array('Core.RemoveInvalidImg' => false) - ); - // align transformation - $this->assertResult( - 'foobar', - 'foobar' - ); - $this->assertResult( - 'foobar', - 'foobar' - ); - $this->assertResult( - 'foobar', - 'foobar' - ); - $this->assertResult( - 'foobar', - 'foobar' - ); - $this->assertResult( - 'foobar', - 'foobar' - ); - $this->assertResult( - 'foobar', - 'foobar' - ); - - } - - function testBdo() { - // test required attributes for bdo - $this->assertResult( - 'Go left.', - 'Go left.' - ); - - $this->assertResult( - 'Invalid value!', - 'Invalid value!' + 'mailto:foo@example.com' ); } - function testDir() { - // see testBdo, behavior is subtly different - $this->assertResult( - 'Invalid value!', - 'Invalid value!' - ); + function testPreserveRel() { + $this->config->set('Attr', 'AllowedRel', 'nofollow'); + $this->assertResult(''); } - - function testLinks() { - // link types - $this->assertResult( - '', - true, - array('Attr.AllowedRel' => 'nofollow') - ); - // link targets - $this->assertResult( - '', - true, - array('Attr.AllowedFrameTargets' => '_top', - 'HTML.Doctype' => 'XHTML 1.0 Transitional') - ); + + function testPreserveTarget() { + $this->config->set('Attr', 'AllowedFrameTargets', '_top'); + $this->config->set('HTML', 'Doctype', 'XHTML 1.0 Transitional'); + $this->assertResult(''); + } + + function testRemoveTargetWhenNotSupported() { + $this->config->set('HTML', 'Doctype', 'XHTML 1.0 Strict'); + $this->config->set('Attr', 'AllowedFrameTargets', '_top'); $this->assertResult( '', '' ); - $this->assertResult( - '', - '', - array('Attr.AllowedFrameTargets' => '_top', 'HTML.Strict' => true) - ); - } - - function testBorder() { - // border - $this->assertResult( - 'foo', - 'foo', - array('Attr.AllowedRel' => 'nofollow') - ); - } - - function testHr() { - $this->assertResult( - '
      ', - '
      ' - ); - $this->assertResult( - '
      ', - '
      ' - ); - // align transformation - $this->assertResult( - '
      ', - '
      ' - ); - $this->assertResult( - '
      ', - '
      ' - ); - $this->assertResult( - '
      ', - '
      ' - ); - $this->assertResult( - '
      ', - '
      ' - ); - } - - function testBr() { - // br clear transformation - $this->assertResult( - '
      ', - '
      ' - ); - $this->assertResult( - '
      ', - '
      ' - ); - $this->assertResult( // test both? - '
      ', - '
      ' - ); - $this->assertResult( - '
      ', - '
      ' - ); - $this->assertResult( - '
      ', - '
      ' - ); - } - - function testListTypeTransform() { - // ul - $this->assertResult( - '
        ', - '
          ' - ); - $this->assertResult( - '
            ', - '
              ' - ); - $this->assertResult( - '
                ', - '
                  ' - ); - $this->assertResult( // case insensitive - '
                    ', - '
                      ' - ); - $this->assertResult( - '
                        ', - '
                          ' - ); - // ol - $this->assertResult( - '
                            ', - '
                              ' - ); - $this->assertResult( - '
                                ', - '
                                  ' - ); - $this->assertResult( - '
                                    ', - '
                                      ' - ); - $this->assertResult( - '
                                        ', - '
                                          ' - ); - $this->assertResult( - '
                                            ', - '
                                              ' - ); - $this->assertResult( - '
                                                ', - '
                                                  ' - ); - // li - $this->assertResult( - '
                                                1. ', - '
                                                2. ' - ); - $this->assertResult( - '
                                                3. ', - '
                                                4. ' - ); - $this->assertResult( // case sensitive - '
                                                5. ', - '
                                                6. ' - ); - } } diff --git a/tests/test_files.php b/tests/test_files.php index f9fa71c1..5ff30f0c 100644 --- a/tests/test_files.php +++ b/tests/test_files.php @@ -98,9 +98,13 @@ $test_files[] = 'HTMLPurifier/Strategy/FixNestingTest.php'; $test_files[] = 'HTMLPurifier/Strategy/FixNesting_ErrorsTest.php'; $test_files[] = 'HTMLPurifier/Strategy/MakeWellFormedTest.php'; $test_files[] = 'HTMLPurifier/Strategy/MakeWellFormed_ErrorsTest.php'; +$test_files[] = 'HTMLPurifier/Strategy/MakeWellFormed_InjectorTest.php'; $test_files[] = 'HTMLPurifier/Strategy/RemoveForeignElementsTest.php'; $test_files[] = 'HTMLPurifier/Strategy/RemoveForeignElements_ErrorsTest.php'; +$test_files[] = 'HTMLPurifier/Strategy/RemoveForeignElements_TidyTest.php'; $test_files[] = 'HTMLPurifier/Strategy/ValidateAttributesTest.php'; +$test_files[] = 'HTMLPurifier/Strategy/ValidateAttributes_IDTest.php'; +$test_files[] = 'HTMLPurifier/Strategy/ValidateAttributes_TidyTest.php'; $test_files[] = 'HTMLPurifier/TagTransformTest.php'; $test_files[] = 'HTMLPurifier/TokenTest.php'; $test_files[] = 'HTMLPurifier/URIDefinitionTest.php';