Prepended constants with C_ to avoid reserved words as per https://www.php.net/manual...
[htmlpurifier/darkodev.git] / tests / HTMLPurifier / HTMLModule / ScriptingTest.php
blob184b57e0963dcde2b98961963150c6142b303952
1 <?php
3 class HTMLPurifier_HTMLModule_ScriptingTest extends HTMLPurifier_HTMLModuleHarness
6 public function setUp()
8 parent::setUp();
9 $this->config->set('HTML.Trusted', true);
10 $this->config->set('Output.CommentScriptContents', false);
13 public function testDefaultRemoval()
15 $this->config->set('HTML.Trusted', false);
16 $this->assertResult(
17 '<script type="text/javascript">foo();</script>', ''
21 public function testPreserve()
23 $this->assertResult(
24 '<script type="text/javascript">foo();</script>'
28 public function testCDATAEnclosure()
30 $this->assertResult(
31 '<script type="text/javascript">//<![CDATA[
32 alert("<This is compatible with XHTML>");
33 //]]></script>'
37 public function testAllAttributes()
39 $this->assertResult(
40 '<script
41 defer="defer"
42 src="test.js"
43 type="text/javascript"
44 >PCDATA</script>'
48 public function testUnsupportedAttributes()
50 $this->assertResult(
51 '<script
52 type="text/javascript"
53 charset="utf-8"
54 >PCDATA</script>',
55 '<script type="text/javascript">PCDATA</script>'
61 // vim: et sw=4 sts=4