2006-08-02 02:43:52 +00:00
|
|
|
<?php
|
|
|
|
|
|
|
|
require_once 'HTMLPurifier/Token.php';
|
|
|
|
|
|
|
|
class HTMLPurifier_TokenTest extends UnitTestCase
|
|
|
|
{
|
|
|
|
|
2006-12-06 22:29:08 +00:00
|
|
|
function assertTokenConstruction($name, $attr,
|
|
|
|
$expect_name = null, $expect_attr = null
|
2006-08-02 02:43:52 +00:00
|
|
|
) {
|
|
|
|
if ($expect_name === null) $expect_name = $name;
|
2006-12-06 22:29:08 +00:00
|
|
|
if ($expect_attr === null) $expect_attr = $attr;
|
|
|
|
$token = new HTMLPurifier_Token_Start($name, $attr);
|
2006-08-02 02:43:52 +00:00
|
|
|
|
2006-12-06 22:29:08 +00:00
|
|
|
$this->assertEqual($expect_name, $token->name);
|
|
|
|
$this->assertEqual($expect_attr, $token->attr);
|
2006-08-02 02:43:52 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
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'));
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
?>
|