SafeScriptingTest.php 705 B

123456789101112131415161718192021222324252627282930313233
  1. <?php
  2. class HTMLPurifier_HTMLModule_SafeScriptingTest extends HTMLPurifier_HTMLModuleHarness
  3. {
  4. function setUp() {
  5. parent::setUp();
  6. $this->config->set('HTML.SafeScripting', array('http://localhost/foo.js'));
  7. }
  8. function testMinimal() {
  9. $this->assertResult(
  10. '<script></script>',
  11. ''
  12. );
  13. }
  14. function testGood() {
  15. $this->assertResult(
  16. '<script type="text/javascript" src="http://localhost/foo.js" />'
  17. );
  18. }
  19. function testBad() {
  20. $this->assertResult(
  21. '<script type="text/javascript" src="http://localhost/foobar.js" />',
  22. ''
  23. );
  24. }
  25. }
  26. // vim: et sw=4 sts=4