Fix newline issues in tests.
[htmlpurifier/darkodev.git] / tests / HTMLPurifier / ElementDefTest.php
blobe81ca5156574fa8129a2e98bd0ae1c3742ab7ca5
1 <?php
3 class HTMLPurifier_ElementDefTest extends HTMLPurifier_Harness
6 function test_mergeIn() {
8 $def1 = new HTMLPurifier_ElementDef();
9 $def2 = new HTMLPurifier_ElementDef();
10 $def3 = new HTMLPurifier_ElementDef();
12 $old = 1;
13 $new = 2;
14 $overloaded_old = 3;
15 $overloaded_new = 4;
16 $removed = 5;
18 $def1->standalone = true;
19 $def1->attr = array(
20 0 => array('old-include'),
21 'old-attr' => $old,
22 'overloaded-attr' => $overloaded_old,
23 'removed-attr' => $removed,
25 $def1->attr_transform_pre =
26 $def1->attr_transform_post = array(
27 'old-transform' => $old,
28 'overloaded-transform' => $overloaded_old,
29 'removed-transform' => $removed,
31 $def1->child = $overloaded_old;
32 $def1->content_model = 'old';
33 $def1->content_model_type = $overloaded_old;
34 $def1->descendants_are_inline = false;
35 $def1->excludes = array(
36 'old' => true,
37 'removed-old' => true
40 $def2->standalone = false;
41 $def2->attr = array(
42 0 => array('new-include'),
43 'new-attr' => $new,
44 'overloaded-attr' => $overloaded_new,
45 'removed-attr' => false,
47 $def2->attr_transform_pre =
48 $def2->attr_transform_post = array(
49 'new-transform' => $new,
50 'overloaded-transform' => $overloaded_new,
51 'removed-transform' => false,
53 $def2->child = $new;
54 $def2->content_model = 'new';
55 $def2->content_model_type = $overloaded_new;
56 $def2->descendants_are_inline = true;
57 $def2->excludes = array(
58 'new' => true,
59 'removed-old' => false
62 $def1->mergeIn($def2);
63 $def1->mergeIn($def3); // empty, has no effect
65 $this->assertIdentical($def1->standalone, true);
66 $this->assertIdentical($def1->attr, array(
67 0 => array('old-include', 'new-include'),
68 'old-attr' => $old,
69 'overloaded-attr' => $overloaded_new,
70 'new-attr' => $new,
71 ));
72 $this->assertIdentical($def1->attr_transform_pre, $def1->attr_transform_post);
73 $this->assertIdentical($def1->attr_transform_pre, array(
74 'old-transform' => $old,
75 'overloaded-transform' => $overloaded_new,
76 'new-transform' => $new,
77 ));
78 $this->assertIdentical($def1->child, $new);
79 $this->assertIdentical($def1->content_model, 'old | new');
80 $this->assertIdentical($def1->content_model_type, $overloaded_new);
81 $this->assertIdentical($def1->descendants_are_inline, true);
82 $this->assertIdentical($def1->excludes, array(
83 'old' => true,
84 'new' => true
85 ));