4 * This test is kinda weird, because it doesn't test the full safe object
5 * functionality, just a small section of it. Or maybe it's actually the right
8 class HTMLPurifier_Injector_SafeObjectTest
extends HTMLPurifier_InjectorHarness
13 // there is no AutoFormat.SafeObject directive
14 $this->config
->set('AutoFormat.Custom', array(new HTMLPurifier_Injector_SafeObject()));
15 $this->config
->set('HTML.Trusted', true);
18 function testPreserve() {
24 function testRemoveStrayParam() {
31 function testEditObjectParam() {
34 '<object><param name="allowScriptAccess" value="never" /><param name="allowNetworking" value="internal" /></object>'
38 function testIgnoreStrayParam() {
40 '<object><param /></object>',
41 '<object><param name="allowScriptAccess" value="never" /><param name="allowNetworking" value="internal" /></object>'
45 function testIgnoreDuplicates() {
47 '<object><param name="allowScriptAccess" value="never" /><param name="allowNetworking" value="internal" /></object>'
51 function testIgnoreBogusData() {
53 '<object><param name="allowScriptAccess" value="always" /><param name="allowNetworking" value="always" /></object>',
54 '<object><param name="allowScriptAccess" value="never" /><param name="allowNetworking" value="internal" /></object>'
58 function testIgnoreInvalidData() {
60 '<object><param name="foo" value="bar" /></object>',
61 '<object><param name="allowScriptAccess" value="never" /><param name="allowNetworking" value="internal" /></object>'
65 function testKeepValidData() {
67 '<object><param name="movie" value="bar" /></object>',
68 '<object data="bar"><param name="allowScriptAccess" value="never" /><param name="allowNetworking" value="internal" /><param name="movie" value="bar" /></object>'
72 function testNested() {
74 '<object><param name="allowScriptAccess" value="never" /><param name="allowNetworking" value="internal" /><object></object></object>',
75 '<object><param name="allowScriptAccess" value="never" /><param name="allowNetworking" value="internal" /><object><param name="allowScriptAccess" value="never" /><param name="allowNetworking" value="internal" /></object></object>'
79 function testNotActuallyNested() {
81 '<object><p><param name="allowScriptAccess" value="never" /><param name="allowNetworking" value="internal" /></p></object>',
82 '<object><param name="allowScriptAccess" value="never" /><param name="allowNetworking" value="internal" /><p></p></object>'