2006-07-30 00:54:38 +00:00
|
|
|
<?php
|
|
|
|
|
2006-08-05 00:30:31 +00:00
|
|
|
require_once 'HTMLPurifier/AttrDefHarness.php';
|
2006-07-30 00:54:38 +00:00
|
|
|
require_once 'HTMLPurifier/AttrDef/Enum.php';
|
|
|
|
|
2006-08-05 00:30:31 +00:00
|
|
|
class HTMLPurifier_AttrDef_EnumTest extends HTMLPurifier_AttrDefHarness
|
2006-07-30 00:54:38 +00:00
|
|
|
{
|
|
|
|
|
|
|
|
function testCaseInsensitive() {
|
|
|
|
|
2006-08-05 00:30:31 +00:00
|
|
|
$this->def = new HTMLPurifier_AttrDef_Enum(array('one', 'two'));
|
2006-07-30 00:54:38 +00:00
|
|
|
|
2006-08-05 00:30:31 +00:00
|
|
|
$this->assertDef('one');
|
|
|
|
$this->assertDef('ONE', 'one');
|
2006-07-30 00:54:38 +00:00
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
function testCaseSensitive() {
|
|
|
|
|
2006-08-05 00:30:31 +00:00
|
|
|
$this->def = new HTMLPurifier_AttrDef_Enum(array('one', 'two'), true);
|
2006-07-30 00:54:38 +00:00
|
|
|
|
2006-08-05 00:30:31 +00:00
|
|
|
$this->assertDef('one');
|
|
|
|
$this->assertDef('ONE', false);
|
2006-07-30 00:54:38 +00:00
|
|
|
|
|
|
|
}
|
|
|
|
|
2006-08-04 00:11:54 +00:00
|
|
|
function testFixing() {
|
|
|
|
|
2006-08-05 00:30:31 +00:00
|
|
|
$this->def = new HTMLPurifier_AttrDef_Enum(array('one'));
|
2006-08-04 00:11:54 +00:00
|
|
|
|
2006-08-05 00:30:31 +00:00
|
|
|
$this->assertDef(' one ', 'one');
|
2006-08-04 00:11:54 +00:00
|
|
|
|
|
|
|
}
|
|
|
|
|
2006-07-30 00:54:38 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
?>
|