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'));
|
|
|
|
$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);
|
|
|
|
$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'));
|
|
|
|
$this->assertDef(' one ', 'one');
|
2007-05-23 00:39:07 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
function test_make() {
|
|
|
|
$factory = new HTMLPurifier_AttrDef_Enum();
|
|
|
|
$def = $factory->make('foo,bar');
|
|
|
|
$def2 = new HTMLPurifier_AttrDef_Enum(array('foo', 'bar'));
|
|
|
|
$this->assertIdentical($def, $def2);
|
2006-08-04 00:11:54 +00:00
|
|
|
}
|
|
|
|
|
2006-07-30 00:54:38 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
?>
|