diff options
author | friendica <info@friendica.com> | 2012-05-12 17:57:41 -0700 |
---|---|---|
committer | friendica <info@friendica.com> | 2012-07-18 20:40:31 +1000 |
commit | 7a40f4354b32809af3d0cfd6e3af0eda02ab0e0a (patch) | |
tree | a9c3d91209cff770bb4b613b1b95e61a7bbc5a2b /lib/htmlpurifier/tests/HTMLPurifier/ElementDefTest.php | |
parent | cd727cb26b78a1dade09d510b071446898477356 (diff) | |
download | volse-hubzilla-7a40f4354b32809af3d0cfd6e3af0eda02ab0e0a.tar.gz volse-hubzilla-7a40f4354b32809af3d0cfd6e3af0eda02ab0e0a.tar.bz2 volse-hubzilla-7a40f4354b32809af3d0cfd6e3af0eda02ab0e0a.zip |
some important stuff we'll need
Diffstat (limited to 'lib/htmlpurifier/tests/HTMLPurifier/ElementDefTest.php')
-rw-r--r-- | lib/htmlpurifier/tests/HTMLPurifier/ElementDefTest.php | 91 |
1 files changed, 91 insertions, 0 deletions
diff --git a/lib/htmlpurifier/tests/HTMLPurifier/ElementDefTest.php b/lib/htmlpurifier/tests/HTMLPurifier/ElementDefTest.php new file mode 100644 index 000000000..500312b3c --- /dev/null +++ b/lib/htmlpurifier/tests/HTMLPurifier/ElementDefTest.php @@ -0,0 +1,91 @@ +<?php + +class HTMLPurifier_ElementDefTest extends HTMLPurifier_Harness +{ + + function test_mergeIn() { + + $def1 = new HTMLPurifier_ElementDef(); + $def2 = new HTMLPurifier_ElementDef(); + $def3 = new HTMLPurifier_ElementDef(); + + $old = 1; + $new = 2; + $overloaded_old = 3; + $overloaded_new = 4; + $removed = 5; + + $def1->standalone = true; + $def1->attr = array( + 0 => array('old-include'), + 'old-attr' => $old, + 'overloaded-attr' => $overloaded_old, + 'removed-attr' => $removed, + ); + $def1->attr_transform_pre = + $def1->attr_transform_post = array( + 'old-transform' => $old, + 'overloaded-transform' => $overloaded_old, + 'removed-transform' => $removed, + ); + $def1->child = $overloaded_old; + $def1->content_model = 'old'; + $def1->content_model_type = $overloaded_old; + $def1->descendants_are_inline = false; + $def1->excludes = array( + 'old' => true, + 'removed-old' => true + ); + + $def2->standalone = false; + $def2->attr = array( + 0 => array('new-include'), + 'new-attr' => $new, + 'overloaded-attr' => $overloaded_new, + 'removed-attr' => false, + ); + $def2->attr_transform_pre = + $def2->attr_transform_post = array( + 'new-transform' => $new, + 'overloaded-transform' => $overloaded_new, + 'removed-transform' => false, + ); + $def2->child = $new; + $def2->content_model = '#SUPER | new'; + $def2->content_model_type = $overloaded_new; + $def2->descendants_are_inline = true; + $def2->excludes = array( + 'new' => true, + 'removed-old' => false + ); + + $def1->mergeIn($def2); + $def1->mergeIn($def3); // empty, has no effect + + $this->assertIdentical($def1->standalone, true); + $this->assertIdentical($def1->attr, array( + 0 => array('old-include', 'new-include'), + 'old-attr' => $old, + 'overloaded-attr' => $overloaded_new, + 'new-attr' => $new, + )); + $this->assertIdentical($def1->attr_transform_pre, $def1->attr_transform_post); + $this->assertIdentical($def1->attr_transform_pre, array( + 'old-transform' => $old, + 'overloaded-transform' => $overloaded_new, + 'new-transform' => $new, + )); + $this->assertIdentical($def1->child, $new); + $this->assertIdentical($def1->content_model, 'old | new'); + $this->assertIdentical($def1->content_model_type, $overloaded_new); + $this->assertIdentical($def1->descendants_are_inline, true); + $this->assertIdentical($def1->excludes, array( + 'old' => true, + 'new' => true + )); + + } + +} + +// vim: et sw=4 sts=4 |