RemoveForeignElements_TidyTest.php 1.2 KB

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