0
0
mirror of https://github.com/ezyang/htmlpurifier.git synced 2024-11-08 14:58:42 +00: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:
Edward Z. Yang 2007-05-21 00:24:32 +00:00
parent a470fc5621
commit 831db14c79
7 changed files with 0 additions and 270 deletions

View File

@ -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>'
);
}
}
?>

View File

@ -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>'
);
}
}
?>

View File

@ -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>'
);
}
}
?>

View File

@ -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" />'
);
}
}
?>

View File

@ -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>'
);*/
}
}
?>

View File

@ -9,27 +9,6 @@ class HTMLPurifier_HTMLModuleHarness extends HTMLPurifier_StrategyHarness
parent::setup();
$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')
);
}
?>

View File

@ -65,11 +65,6 @@ $test_files[] = 'EntityParserTest.php';
$test_files[] = 'GeneratorTest.php';
$test_files[] = 'HTMLModuleManagerTest.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/TidyTest.php';
$test_files[] = 'IDAccumulatorTest.php';