3 class HTMLPurifier_ElementDefTest
extends HTMLPurifier_Harness
6 public function test_mergeIn()
8 $def1 = new HTMLPurifier_ElementDef();
9 $def2 = new HTMLPurifier_ElementDef();
10 $def3 = new HTMLPurifier_ElementDef();
18 $def1->standalone
= true;
20 0 => array('old-include'),
22 'overloaded-attr' => $overloaded_old,
23 'removed-attr' => $removed,
26 $def1->attr_transform_pre =
27 $def1->attr_transform_post = array(
28 'old-transform' => $old,
29 'overloaded-transform' => $overloaded_old,
30 'removed-transform' => $removed,
33 $def1->attr_transform_pre
[] = $old;
34 $def1->attr_transform_post
[] = $old;
35 $def1->child
= $overloaded_old;
36 $def1->content_model
= 'old';
37 $def1->content_model_type
= $overloaded_old;
38 $def1->descendants_are_inline
= false;
39 $def1->excludes
= array(
44 $def2->standalone
= false;
46 0 => array('new-include'),
48 'overloaded-attr' => $overloaded_new,
49 'removed-attr' => false,
52 $def2->attr_transform_pre =
53 $def2->attr_transform_post = array(
54 'new-transform' => $new,
55 'overloaded-transform' => $overloaded_new,
56 'removed-transform' => false,
59 $def2->attr_transform_pre
[] = $new;
60 $def2->attr_transform_post
[] = $new;
62 $def2->content_model
= '#SUPER | new';
63 $def2->content_model_type
= $overloaded_new;
64 $def2->descendants_are_inline
= true;
65 $def2->excludes
= array(
67 'removed-old' => false
70 $def1->mergeIn($def2);
71 $def1->mergeIn($def3); // empty, has no effect
73 $this->assertIdentical($def1->standalone
, true);
74 $this->assertIdentical($def1->attr
, array(
75 0 => array('old-include', 'new-include'),
77 'overloaded-attr' => $overloaded_new,
80 $this->assertIdentical($def1->attr_transform_pre
, $def1->attr_transform_post
);
81 $this->assertIdentical($def1->attr_transform_pre
, array($old, $new));
83 $this->assertIdentical($def1->attr_transform_pre, array(
84 'old-transform' => $old,
85 'overloaded-transform' => $overloaded_new,
86 'new-transform' => $new,
89 $this->assertIdentical($def1->child
, $new);
90 $this->assertIdentical($def1->content_model
, 'old | new');
91 $this->assertIdentical($def1->content_model_type
, $overloaded_new);
92 $this->assertIdentical($def1->descendants_are_inline
, true);
93 $this->assertIdentical($def1->excludes
, array(
102 // vim: et sw=4 sts=4