mirror of
https://github.com/ezyang/htmlpurifier.git
synced 2025-08-03 20:58:11 +02:00
[1.7.0] Remove HTMLModule tests. They were a bad idea.
git-svn-id: http://htmlpurifier.org/svnroot/htmlpurifier/trunk@1083 48356398-32a2-884e-a903-53898d9a118a
This commit is contained in:
@@ -1,42 +0,0 @@
|
|||||||
<?php
|
|
||||||
|
|
||||||
require_once 'HTMLPurifier/HTMLModuleHarness.php';
|
|
||||||
|
|
||||||
class HTMLPurifier_HTMLModule_BdoTest extends HTMLPurifier_HTMLModuleHarness
|
|
||||||
{
|
|
||||||
|
|
||||||
function test() {
|
|
||||||
|
|
||||||
$this->setupScaffold('Bdo');
|
|
||||||
|
|
||||||
// max
|
|
||||||
$this->assertResult(
|
|
||||||
'<span>
|
|
||||||
<bdo ac:core="yes" dir="rtl">
|
|
||||||
#PCDATA <span>Inline</span>
|
|
||||||
</bdo>
|
|
||||||
</span>'
|
|
||||||
);
|
|
||||||
|
|
||||||
// min
|
|
||||||
$this->assertResult(
|
|
||||||
'<bdo></bdo>', '<bdo dir="ltr"></bdo>'
|
|
||||||
);
|
|
||||||
|
|
||||||
// children
|
|
||||||
$this->assertResult(
|
|
||||||
'<bdo dir="rtl">Text<span></span><div></div></bdo>',
|
|
||||||
'<bdo dir="rtl">Text<span></span></bdo>'
|
|
||||||
);
|
|
||||||
|
|
||||||
// global attr
|
|
||||||
$this->assertResult(
|
|
||||||
'<br dir="ltr" /><span dir="ltr"></span>',
|
|
||||||
'<br /><span dir="ltr"></span>'
|
|
||||||
);
|
|
||||||
|
|
||||||
}
|
|
||||||
|
|
||||||
}
|
|
||||||
|
|
||||||
?>
|
|
@@ -1,60 +0,0 @@
|
|||||||
<?php
|
|
||||||
|
|
||||||
require_once 'HTMLPurifier/HTMLModuleHarness.php';
|
|
||||||
|
|
||||||
class HTMLPurifier_HTMLModule_EditTest extends HTMLPurifier_HTMLModuleHarness
|
|
||||||
{
|
|
||||||
|
|
||||||
function test() {
|
|
||||||
|
|
||||||
$this->setupScaffold('Edit');
|
|
||||||
|
|
||||||
// max
|
|
||||||
$this->assertResult(
|
|
||||||
'<span>
|
|
||||||
<ins cite="http://www.example.com/" ac:common="yes">
|
|
||||||
#PCDATA <span></span>
|
|
||||||
</ins>
|
|
||||||
<del cite="http://www.example.com/" ac:common="yes">
|
|
||||||
#PCDATA <span></span>
|
|
||||||
</del>
|
|
||||||
</span>
|
|
||||||
<div>
|
|
||||||
<ins cite="http://www.example.com/" ac:common="yes">
|
|
||||||
#PCDATA <div></div> <span></span>
|
|
||||||
</ins>
|
|
||||||
<del cite="http://www.example.com/" ac:common="yes">
|
|
||||||
#PCDATA <div></div> <span></span>
|
|
||||||
</del>
|
|
||||||
</div>'
|
|
||||||
);
|
|
||||||
|
|
||||||
// inline removal
|
|
||||||
$this->assertResult(
|
|
||||||
'<span>
|
|
||||||
<ins><div></div></ins>
|
|
||||||
<del><div></div></del>
|
|
||||||
</span>',
|
|
||||||
'<span>
|
|
||||||
<ins></ins>
|
|
||||||
<del></del>
|
|
||||||
</span>'
|
|
||||||
);
|
|
||||||
|
|
||||||
// unsupported attributes
|
|
||||||
$this->assertResult(
|
|
||||||
'<ins
|
|
||||||
datetime="1994-11-05T13:15:30Z"
|
|
||||||
></ins>
|
|
||||||
<del
|
|
||||||
datetime="1994-11-05T13:15:30Z"
|
|
||||||
></del>',
|
|
||||||
'<ins></ins>
|
|
||||||
<del></del>'
|
|
||||||
);
|
|
||||||
|
|
||||||
}
|
|
||||||
|
|
||||||
}
|
|
||||||
|
|
||||||
?>
|
|
@@ -1,55 +0,0 @@
|
|||||||
<?php
|
|
||||||
|
|
||||||
require_once 'HTMLPurifier/HTMLModuleHarness.php';
|
|
||||||
|
|
||||||
class HTMLPurifier_HTMLModule_HypertextTest extends HTMLPurifier_HTMLModuleHarness
|
|
||||||
{
|
|
||||||
|
|
||||||
function test() {
|
|
||||||
|
|
||||||
$this->setupScaffold('Hypertext', array(
|
|
||||||
'Attr.AllowedRel' => 'nofollow',
|
|
||||||
'Attr.AllowedRev' => 'index'
|
|
||||||
));
|
|
||||||
|
|
||||||
// max
|
|
||||||
$this->assertResult(
|
|
||||||
'<span>
|
|
||||||
<a
|
|
||||||
href="http://www.example.com/"
|
|
||||||
rel="nofollow"
|
|
||||||
rev="index"
|
|
||||||
ac:common="true"
|
|
||||||
>
|
|
||||||
#PCDATA <span>Inline</span>
|
|
||||||
</a>
|
|
||||||
</span>', true
|
|
||||||
);
|
|
||||||
|
|
||||||
// invalid children
|
|
||||||
$this->assertResult(
|
|
||||||
'<a>Text<span><a></a></span><div></div><a></a></a>',
|
|
||||||
'<a>Text<span></span></a>'
|
|
||||||
);
|
|
||||||
|
|
||||||
// unsupported attributes
|
|
||||||
$this->assertResult(
|
|
||||||
'<a
|
|
||||||
charset="utf-8"
|
|
||||||
type="text/html"
|
|
||||||
hreflang="en"
|
|
||||||
accesskey="f"
|
|
||||||
shape="rect"
|
|
||||||
coords="0,0,20,0"
|
|
||||||
tabindex="3"
|
|
||||||
onfocus="foo();"
|
|
||||||
onblur="bar();"
|
|
||||||
></a>',
|
|
||||||
'<a></a>'
|
|
||||||
);
|
|
||||||
|
|
||||||
}
|
|
||||||
|
|
||||||
}
|
|
||||||
|
|
||||||
?>
|
|
@@ -1,53 +0,0 @@
|
|||||||
<?php
|
|
||||||
|
|
||||||
require_once 'HTMLPurifier/HTMLModuleHarness.php';
|
|
||||||
|
|
||||||
class HTMLPurifier_HTMLModule_ImageTest extends HTMLPurifier_HTMLModuleHarness
|
|
||||||
{
|
|
||||||
|
|
||||||
function test() {
|
|
||||||
|
|
||||||
$this->setupScaffold('Image');
|
|
||||||
|
|
||||||
// max
|
|
||||||
$this->assertResult(
|
|
||||||
'<span>
|
|
||||||
<img
|
|
||||||
src="example.png"
|
|
||||||
alt="Example image"
|
|
||||||
longdesc="example.description.txt"
|
|
||||||
height="42"
|
|
||||||
width="42"
|
|
||||||
ac:common="yes"
|
|
||||||
/>
|
|
||||||
</span>'
|
|
||||||
);
|
|
||||||
|
|
||||||
// required attributes
|
|
||||||
$this->assertResult(
|
|
||||||
'<img src="foo.png" />',
|
|
||||||
'<img src="foo.png" alt="foo.png" />'
|
|
||||||
);
|
|
||||||
|
|
||||||
// empty
|
|
||||||
$this->assertResult(
|
|
||||||
'<img src="foo.png" alt="foo">',
|
|
||||||
'<img src="foo.png" alt="foo" />'
|
|
||||||
);
|
|
||||||
|
|
||||||
// unsupported attributes
|
|
||||||
$this->assertResult(
|
|
||||||
'<img
|
|
||||||
src="example.png"
|
|
||||||
alt="Example"
|
|
||||||
usemap="#foo"
|
|
||||||
ismap="ismap"
|
|
||||||
/>',
|
|
||||||
'<img src="example.png" alt="Example" />'
|
|
||||||
);
|
|
||||||
|
|
||||||
}
|
|
||||||
|
|
||||||
}
|
|
||||||
|
|
||||||
?>
|
|
@@ -1,34 +0,0 @@
|
|||||||
<?php
|
|
||||||
|
|
||||||
require_once 'HTMLPurifier/HTMLModuleHarness.php';
|
|
||||||
|
|
||||||
class HTMLPurifier_HTMLModule_LegacyTest extends HTMLPurifier_HTMLModuleHarness
|
|
||||||
{
|
|
||||||
|
|
||||||
function test() {
|
|
||||||
|
|
||||||
$this->setupScaffold('Legacy');
|
|
||||||
|
|
||||||
// max
|
|
||||||
$this->assertResult(
|
|
||||||
'<span>
|
|
||||||
<u ac:common="yes">Text<span></span></u>
|
|
||||||
<s ac:common="yes">Text<span></span></s>
|
|
||||||
<strike ac:common="yes">Text<span></span></strike>
|
|
||||||
</span>'
|
|
||||||
);
|
|
||||||
|
|
||||||
// redefinitions
|
|
||||||
/*$this->assertResult(
|
|
||||||
'<ol start="3">
|
|
||||||
<li value="2">Foo</li>
|
|
||||||
</ol>
|
|
||||||
<address>Text<span></span><p></p></address>
|
|
||||||
<blockquote>Text<span></span><div></div></blockquote>'
|
|
||||||
);*/
|
|
||||||
|
|
||||||
}
|
|
||||||
|
|
||||||
}
|
|
||||||
|
|
||||||
?>
|
|
@@ -9,27 +9,6 @@ class HTMLPurifier_HTMLModuleHarness extends HTMLPurifier_StrategyHarness
|
|||||||
parent::setup();
|
parent::setup();
|
||||||
$this->obj = new HTMLPurifier_Strategy_Core();
|
$this->obj = new HTMLPurifier_Strategy_Core();
|
||||||
}
|
}
|
||||||
|
|
||||||
function setupScaffold($module, $config = array()) {
|
|
||||||
|
|
||||||
$this->config = HTMLPurifier_Config::create($config);
|
|
||||||
$this->config->set('HTML', 'AllowedModules', $module);
|
|
||||||
$def =& $this->config->getHTMLDefinition(true);
|
|
||||||
$def->manager->addModule(new HTMLPurifier_HTMLModuleHarness_Scaffold());
|
|
||||||
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Special module that defines scaffolding for easy unit testing
|
|
||||||
*/
|
|
||||||
class HTMLPurifier_HTMLModuleHarness_Scaffold extends HTMLPurifier_HTMLModule
|
|
||||||
{
|
|
||||||
var $name = 'Scaffold';
|
|
||||||
var $attr_collections = array(
|
|
||||||
'Common' => array('ac:common' => 'Text'),
|
|
||||||
'Core' => array('ac:core' => 'Text')
|
|
||||||
);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
?>
|
?>
|
@@ -65,11 +65,6 @@ $test_files[] = 'EntityParserTest.php';
|
|||||||
$test_files[] = 'GeneratorTest.php';
|
$test_files[] = 'GeneratorTest.php';
|
||||||
$test_files[] = 'HTMLModuleManagerTest.php';
|
$test_files[] = 'HTMLModuleManagerTest.php';
|
||||||
$test_files[] = 'HTMLModuleTest.php';
|
$test_files[] = 'HTMLModuleTest.php';
|
||||||
$test_files[] = 'HTMLModule/BdoTest.php';
|
|
||||||
$test_files[] = 'HTMLModule/EditTest.php';
|
|
||||||
$test_files[] = 'HTMLModule/HypertextTest.php';
|
|
||||||
$test_files[] = 'HTMLModule/ImageTest.php';
|
|
||||||
$test_files[] = 'HTMLModule/LegacyTest.php';
|
|
||||||
$test_files[] = 'HTMLModule/ScriptingTest.php';
|
$test_files[] = 'HTMLModule/ScriptingTest.php';
|
||||||
$test_files[] = 'HTMLModule/TidyTest.php';
|
$test_files[] = 'HTMLModule/TidyTest.php';
|
||||||
$test_files[] = 'IDAccumulatorTest.php';
|
$test_files[] = 'IDAccumulatorTest.php';
|
||||||
|
Reference in New Issue
Block a user