mirror of
https://github.com/ezyang/htmlpurifier.git
synced 2025-08-05 21:57:26 +02:00
Fix case-sensitivity issues for attributes. Added TokenTest. Updated TODO. Removed TagTransform::normalizeAttributes
git-svn-id: http://htmlpurifier.org/svnroot/htmlpurifier/trunk@142 48356398-32a2-884e-a903-53898d9a118a
This commit is contained in:
36
tests/HTMLPurifier/TokenTest.php
Normal file
36
tests/HTMLPurifier/TokenTest.php
Normal file
@@ -0,0 +1,36 @@
|
||||
<?php
|
||||
|
||||
require_once 'HTMLPurifier/Token.php';
|
||||
|
||||
class HTMLPurifier_TokenTest extends UnitTestCase
|
||||
{
|
||||
|
||||
function assertTokenConstruction($name, $attributes,
|
||||
$expect_name = null, $expect_attributes = null
|
||||
) {
|
||||
if ($expect_name === null) $expect_name = $name;
|
||||
if ($expect_attributes === null) $expect_attributes = $attributes;
|
||||
$token = new HTMLPurifier_Token_Start($name, $attributes);
|
||||
|
||||
$this->assertEqual($expect_name, $token->name);
|
||||
$this->assertEqual($expect_attributes, $token->attributes);
|
||||
}
|
||||
|
||||
function testConstruct() {
|
||||
|
||||
// standard case
|
||||
$this->assertTokenConstruction('a', array('href' => 'about:blank'));
|
||||
|
||||
// lowercase the tag's name
|
||||
$this->assertTokenConstruction('A', array('href' => 'about:blank'),
|
||||
'a');
|
||||
|
||||
// lowercase attributes
|
||||
$this->assertTokenConstruction('a', array('HREF' => 'about:blank'),
|
||||
'a', array('href' => 'about:blank'));
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
?>
|
Reference in New Issue
Block a user