1
0
mirror of https://github.com/ezyang/htmlpurifier.git synced 2025-07-10 17:26:25 +02:00
Files
php-htmlpurifier/tests/HTMLPurifier/HTMLModule/HypertextTest.php
Edward Z. Yang a470fc5621 [1.7.0] Refactor HTMLModule unit tests
- AttrCollections does not barf when an inclusion is not present
- HTMLDefinition configuration directives now use new syntax
- Added %HTML.AllowedModules and %HTML.CoreModules for testing
- Extend Harness so that it can accept a default configuration object member variable
- Refactor modules to use Scaffolding, which defines some custom attributes that allows for the easy testing of attribute collections

git-svn-id: http://htmlpurifier.org/svnroot/htmlpurifier/trunk@1082 48356398-32a2-884e-a903-53898d9a118a
2007-05-20 22:29:31 +00:00

55 lines
1.3 KiB
PHP

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