You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

35 lines
1010B

  1. <?php
  2. class HTMLPurifier_TokenTest extends HTMLPurifier_Harness
  3. {
  4. protected function assertTokenConstruction($name, $attr,
  5. $expect_name = null, $expect_attr = null
  6. ) {
  7. if ($expect_name === null) $expect_name = $name;
  8. if ($expect_attr === null) $expect_attr = $attr;
  9. $token = new HTMLPurifier_Token_Start($name, $attr);
  10. $this->assertIdentical($expect_name, $token->name);
  11. $this->assertIdentical($expect_attr, $token->attr);
  12. }
  13. public function testConstruct()
  14. {
  15. // standard case
  16. $this->assertTokenConstruction('a', array('href' => 'about:blank'));
  17. // lowercase the tag's name
  18. $this->assertTokenConstruction('A', array('href' => 'about:blank'),
  19. 'a');
  20. // lowercase attributes
  21. $this->assertTokenConstruction('a', array('HREF' => 'about:blank'),
  22. 'a', array('href' => 'about:blank'));
  23. }
  24. }
  25. // vim: et sw=4 sts=4