RemoveForeignElements_TidyTest.php 1.2 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445
  1. <?php
  2. class HTMLPurifier_Strategy_RemoveForeignElements_TidyTest
  3. extends HTMLPurifier_StrategyHarness
  4. {
  5. function setUp() {
  6. parent::setUp();
  7. $this->obj = new HTMLPurifier_Strategy_RemoveForeignElements();
  8. $this->config->set('HTML.TidyLevel', 'heavy');
  9. }
  10. function testCenterTransform() {
  11. $this->assertResult(
  12. '<center>Look I am Centered!</center>',
  13. '<div style="text-align:center;">Look I am Centered!</div>'
  14. );
  15. }
  16. function testFontTransform() {
  17. $this->assertResult(
  18. '<font color="red" face="Arial" size="6">Big Warning!</font>',
  19. '<span style="color:red;font-family:Arial;font-size:xx-large;">Big'.
  20. ' Warning!</span>'
  21. );
  22. }
  23. function testTransformToForbiddenElement() {
  24. $this->config->set('HTML.Allowed', 'div');
  25. $this->assertResult(
  26. '<font color="red" face="Arial" size="6">Big Warning!</font>',
  27. 'Big Warning!'
  28. );
  29. }
  30. function testMenuTransform() {
  31. $this->assertResult(
  32. '<menu><li>Item 1</li></menu>',
  33. '<ul><li>Item 1</li></ul>'
  34. );
  35. }
  36. }
  37. // vim: et sw=4 sts=4