mirror of
https://github.com/ezyang/htmlpurifier.git
synced 2024-11-10 07:38:41 +00:00
1945ddca5c
git-svn-id: http://htmlpurifier.org/svnroot/htmlpurifier/trunk@161 48356398-32a2-884e-a903-53898d9a118a
36 lines
932 B
PHP
36 lines
932 B
PHP
<?php
|
|
|
|
require_once 'HTMLPurifier/AttrDefHarness.php';
|
|
require_once 'HTMLPurifier/AttrDef/ID.php';
|
|
require_once 'HTMLPurifier/IDAccumulator.php';
|
|
|
|
class HTMLPurifier_AttrDef_IDTest extends HTMLPurifier_AttrDefHarness
|
|
{
|
|
|
|
function test() {
|
|
|
|
$this->id_accumulator = new HTMLPurifier_IDAccumulator();
|
|
$this->def = new HTMLPurifier_AttrDef_ID();
|
|
|
|
// valid ID names
|
|
$this->assertDef('alpha');
|
|
$this->assertDef('al_ha');
|
|
$this->assertDef('a0-:.');
|
|
$this->assertDef('a');
|
|
|
|
// invalid ID names
|
|
$this->assertDef('<asa', false);
|
|
$this->assertDef('0123', false);
|
|
$this->assertDef('.asa', false);
|
|
|
|
// test duplicate detection
|
|
$this->assertDef('a', false);
|
|
|
|
// valid once whitespace stripped, but needs to be amended
|
|
$this->assertDef(' whee ', 'whee');
|
|
|
|
}
|
|
|
|
}
|
|
|
|
?>
|