[1.3.1] Standardized all attribute handling variables to attr, made it plural
[htmlpurifier.git] / tests / HTMLPurifier / TokenTest.php
blob6c51808e8ce3eb6c38588890bc510fc39f069970
1 <?php
3 require_once 'HTMLPurifier/Token.php';
5 class HTMLPurifier_TokenTest extends UnitTestCase
8 function assertTokenConstruction($name, $attr,
9 $expect_name = null, $expect_attr = null
10 ) {
11 if ($expect_name === null) $expect_name = $name;
12 if ($expect_attr === null) $expect_attr = $attr;
13 $token = new HTMLPurifier_Token_Start($name, $attr);
15 $this->assertEqual($expect_name, $token->name);
16 $this->assertEqual($expect_attr, $token->attr);
19 function testConstruct() {
21 // standard case
22 $this->assertTokenConstruction('a', array('href' => 'about:blank'));
24 // lowercase the tag's name
25 $this->assertTokenConstruction('A', array('href' => 'about:blank'),
26 'a');
28 // lowercase attributes
29 $this->assertTokenConstruction('a', array('HREF' => 'about:blank'),
30 'a', array('href' => 'about:blank'));