summaryrefslogtreecommitdiff
path: root/library/ezyang/htmlpurifier/tests/HTMLPurifier/HTMLModule/SafeScriptingTest.php
diff options
context:
space:
mode:
Diffstat (limited to 'library/ezyang/htmlpurifier/tests/HTMLPurifier/HTMLModule/SafeScriptingTest.php')
-rw-r--r--library/ezyang/htmlpurifier/tests/HTMLPurifier/HTMLModule/SafeScriptingTest.php37
1 files changed, 37 insertions, 0 deletions
diff --git a/library/ezyang/htmlpurifier/tests/HTMLPurifier/HTMLModule/SafeScriptingTest.php b/library/ezyang/htmlpurifier/tests/HTMLPurifier/HTMLModule/SafeScriptingTest.php
new file mode 100644
index 0000000000..20972975a1
--- /dev/null
+++ b/library/ezyang/htmlpurifier/tests/HTMLPurifier/HTMLModule/SafeScriptingTest.php
@@ -0,0 +1,37 @@
+<?php
+
+class HTMLPurifier_HTMLModule_SafeScriptingTest extends HTMLPurifier_HTMLModuleHarness
+{
+
+ public function setUp()
+ {
+ parent::setUp();
+ $this->config->set('HTML.SafeScripting', array('http://localhost/foo.js'));
+ }
+
+ public function testMinimal()
+ {
+ $this->assertResult(
+ '<script></script>',
+ ''
+ );
+ }
+
+ public function testGood()
+ {
+ $this->assertResult(
+ '<script type="text/javascript" src="http://localhost/foo.js" />'
+ );
+ }
+
+ public function testBad()
+ {
+ $this->assertResult(
+ '<script type="text/javascript" src="http://localhost/foobar.js" />',
+ ''
+ );
+ }
+
+}
+
+// vim: et sw=4 sts=4