2006-08-14 23:11:28 +00:00
|
|
|
<?php
|
|
|
|
|
|
|
|
require_once 'HTMLPurifier/AttrTransform/ImgRequired.php';
|
|
|
|
|
|
|
|
class HTMLPurifier_AttrTransform_ImgRequiredTest extends HTMLPurifier_AttrTransformHarness
|
|
|
|
{
|
|
|
|
|
2006-10-22 03:38:32 +00:00
|
|
|
function setUp() {
|
|
|
|
parent::setUp();
|
|
|
|
$this->obj = new HTMLPurifier_AttrTransform_ImgRequired();
|
|
|
|
}
|
|
|
|
|
2006-08-14 23:11:28 +00:00
|
|
|
function test() {
|
|
|
|
|
2006-10-22 03:38:32 +00:00
|
|
|
$this->assertResult(
|
|
|
|
array(),
|
|
|
|
array('src' => '', 'alt' => 'Invalid image')
|
|
|
|
);
|
|
|
|
|
|
|
|
$this->assertResult(
|
|
|
|
array(),
|
|
|
|
array('src' => 'blank.png', 'alt' => 'Pawned!'),
|
|
|
|
array(
|
|
|
|
'Attr.DefaultInvalidImage' => 'blank.png',
|
|
|
|
'Attr.DefaultInvalidImageAlt' => 'Pawned!'
|
|
|
|
)
|
|
|
|
);
|
|
|
|
|
|
|
|
$this->assertResult(
|
|
|
|
array('src' => '/path/to/foobar.png'),
|
|
|
|
array('src' => '/path/to/foobar.png', 'alt' => 'foobar.png')
|
|
|
|
);
|
|
|
|
|
|
|
|
$this->assertResult(
|
|
|
|
array('alt' => 'intrigue'),
|
|
|
|
array('src' => '', 'alt' => 'intrigue')
|
|
|
|
);
|
2006-08-14 23:11:28 +00:00
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
?>
|