2006-08-04 02:48:20 +00:00
|
|
|
<?php
|
|
|
|
|
2006-08-05 00:30:31 +00:00
|
|
|
require_once 'HTMLPurifier/AttrDefHarness.php';
|
2007-02-03 20:15:33 +00:00
|
|
|
require_once 'HTMLPurifier/AttrDef/Nmtokens.php';
|
2006-08-04 02:48:20 +00:00
|
|
|
require_once 'HTMLPurifier/Config.php';
|
|
|
|
|
2007-02-03 20:15:33 +00:00
|
|
|
class HTMLPurifier_AttrDef_NmtokensTest extends HTMLPurifier_AttrDefHarness
|
2006-08-04 02:48:20 +00:00
|
|
|
{
|
|
|
|
|
|
|
|
function testDefault() {
|
|
|
|
|
2007-02-03 20:15:33 +00:00
|
|
|
$this->def = new HTMLPurifier_AttrDef_Nmtokens();
|
2006-08-04 02:48:20 +00:00
|
|
|
|
2006-08-05 00:30:31 +00:00
|
|
|
$this->assertDef('valid');
|
|
|
|
$this->assertDef('a0-_');
|
|
|
|
$this->assertDef('-valid');
|
|
|
|
$this->assertDef('_valid');
|
|
|
|
$this->assertDef('double valid');
|
2006-08-04 02:48:20 +00:00
|
|
|
|
2006-08-05 00:30:31 +00:00
|
|
|
$this->assertDef('0invalid', false);
|
|
|
|
$this->assertDef('-0', false);
|
2006-08-04 02:48:20 +00:00
|
|
|
|
|
|
|
// test conditional replacement
|
2006-08-05 00:30:31 +00:00
|
|
|
$this->assertDef('validassoc 0invalid', 'validassoc');
|
2006-08-04 02:48:20 +00:00
|
|
|
|
|
|
|
// test whitespace leniency
|
2006-08-05 00:30:31 +00:00
|
|
|
$this->assertDef(" double\nvalid\r", 'double valid');
|
2006-08-04 02:48:20 +00:00
|
|
|
|
2006-08-05 19:52:30 +00:00
|
|
|
// test case sensitivity
|
|
|
|
$this->assertDef('VALID');
|
|
|
|
|
2006-08-04 02:48:20 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
?>
|