0
0
mirror of https://github.com/ezyang/htmlpurifier.git synced 2024-11-10 07:38:41 +00:00
htmlpurifier/tests/HTMLPurifier/HTMLModule/ImageTest.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

53 lines
1.2 KiB
PHP

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