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();
18 $def1->standalone
= true;
20 0 => array('old-include'),
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(
40 $def2->standalone
= false;
42 0 => array('new-include'),
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,
54 $def2->content_model
= 'new';
55 $def2->content_model_type
= $overloaded_new;
56 $def2->descendants_are_inline
= true;
57 $def2->excludes
= array(
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'),
69 'overloaded-attr' => $overloaded_new,
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,
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(