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.

46 lines
1.3KB

  1. <?php
  2. Mock::generatePartial(
  3. 'HTMLPurifier_AttrTransform',
  4. 'HTMLPurifier_AttrTransformTestable',
  5. array('transform'));
  6. class HTMLPurifier_AttrTransformTest extends HTMLPurifier_Harness
  7. {
  8. public function test_prependCSS()
  9. {
  10. $t = new HTMLPurifier_AttrTransformTestable();
  11. $attr = array();
  12. $t->prependCSS($attr, 'style:new;');
  13. $this->assertIdentical(array('style' => 'style:new;'), $attr);
  14. $attr = array('style' => 'style:original;');
  15. $t->prependCSS($attr, 'style:new;');
  16. $this->assertIdentical(array('style' => 'style:new;style:original;'), $attr);
  17. $attr = array('style' => 'style:original;', 'misc' => 'un-related');
  18. $t->prependCSS($attr, 'style:new;');
  19. $this->assertIdentical(array('style' => 'style:new;style:original;', 'misc' => 'un-related'), $attr);
  20. }
  21. public function test_confiscateAttr()
  22. {
  23. $t = new HTMLPurifier_AttrTransformTestable();
  24. $attr = array('flavor' => 'sweet');
  25. $this->assertIdentical('sweet', $t->confiscateAttr($attr, 'flavor'));
  26. $this->assertIdentical(array(), $attr);
  27. $attr = array('flavor' => 'sweet');
  28. $this->assertIdentical(null, $t->confiscateAttr($attr, 'color'));
  29. $this->assertIdentical(array('flavor' => 'sweet'), $attr);
  30. }
  31. }
  32. // vim: et sw=4 sts=4