0
0
mirror of https://github.com/ezyang/htmlpurifier.git synced 2024-09-20 11:15:18 +00:00
htmlpurifier/tests/HTMLPurifier/AttrDef/IDTest.php
Edward Z. Yang 7d2fe4c5d7 [1.2.0]
- Factor out Config and Context object population through arrays
- Bring dependent assertions together in IDTest.php
- AttrDefHarness.php now resets context and configuration between tests
- Add missing reference operator in AttrDef/ID.php

git-svn-id: http://htmlpurifier.org/svnroot/htmlpurifier/trunk@494 48356398-32a2-884e-a903-53898d9a118a
2006-10-21 18:18:36 +00:00

39 lines
1.1 KiB
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->context = new HTMLPurifier_Context();
$id_accumulator = new HTMLPurifier_IDAccumulator();
$this->context->register('IDAccumulator', $id_accumulator);
$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('once');
$this->assertDef('once', false);
// valid once whitespace stripped, but needs to be amended
$this->assertDef(' whee ', 'whee');
}
}
?>