Fix two minor bugs, updating Phorum and removing unused $dir variable.
[htmlpurifier/darkodev.git] / tests / HTMLPurifier / Injector / SafeObjectTest.php
blob59e0493c30d15289d6422da62a608e182a9d1b61
1 <?php
3 /**
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
6 * way.
7 */
8 class HTMLPurifier_Injector_SafeObjectTest extends HTMLPurifier_InjectorHarness
11 function setup() {
12 parent::setup();
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() {
19 $this->assertResult(
20 '<b>asdf</b>'
24 function testRemoveStrayParam() {
25 $this->assertResult(
26 '<param />',
31 function testEditObjectParam() {
32 $this->assertResult(
33 '<object></object>',
34 '<object><param name="allowScriptAccess" value="never" /><param name="allowNetworking" value="internal" /></object>'
38 function testIgnoreStrayParam() {
39 $this->assertResult(
40 '<object><param /></object>',
41 '<object><param name="allowScriptAccess" value="never" /><param name="allowNetworking" value="internal" /></object>'
45 function testIgnoreDuplicates() {
46 $this->assertResult(
47 '<object><param name="allowScriptAccess" value="never" /><param name="allowNetworking" value="internal" /></object>'
51 function testIgnoreBogusData() {
52 $this->assertResult(
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() {
59 $this->assertResult(
60 '<object><param name="foo" value="bar" /></object>',
61 '<object><param name="allowScriptAccess" value="never" /><param name="allowNetworking" value="internal" /></object>'
65 function testKeepValidData() {
66 $this->assertResult(
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() {
73 $this->assertResult(
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() {
80 $this->assertResult(
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>'
88 // vim: et sw=4 sts=4