From e494f65a7727923ca1c12e74e2fa7ccf41d034ad Mon Sep 17 00:00:00 2001 From: uwetews Date: Tue, 12 Jul 2016 23:37:51 +0200 Subject: [PATCH] Extend default handler --- .../LoadPlugin/DefaultPluginHandlerTest.php | 17 ++++++++++++++++- .../templates/test_default_compiler_object.tpl | 1 + 2 files changed, 17 insertions(+), 1 deletion(-) create mode 100644 tests/UnitTests/A_Core/LoadPlugin/templates/test_default_compiler_object.tpl diff --git a/tests/UnitTests/A_Core/LoadPlugin/DefaultPluginHandlerTest.php b/tests/UnitTests/A_Core/LoadPlugin/DefaultPluginHandlerTest.php index effbf613..aa1764f3 100644 --- a/tests/UnitTests/A_Core/LoadPlugin/DefaultPluginHandlerTest.php +++ b/tests/UnitTests/A_Core/LoadPlugin/DefaultPluginHandlerTest.php @@ -56,6 +56,10 @@ class DefaultPluginHandlerTest extends PHPUnit_Smarty { $this->assertEquals("echo 'scriptcompilerfunction '.'foo bar';", $this->smarty->fetch('test_default_compiler_function_script.tpl')); } + public function testDefaultCompilerObject() + { + $this->assertEquals('Public World', $this->smarty->fetch('test_default_compiler_object.tpl')); + } public function testDefaultBlockScript() { @@ -117,7 +121,9 @@ function my_plugin_handler($tag, $type, $template, &$callback, &$script, &$cacha case 'scriptcompilerfunction': $script = './scripts/script_compiler_function_tag.php'; $callback = 'default_script_compiler_function_tag'; - + return true; + case 'compilerobject': + $callback = array(new CompilerDefaultPluginClass, 'compile'); return true; default: return false; @@ -165,3 +171,12 @@ function default_local_modifier($input) { return 'localmodifier ' . $input; } +class CompilerDefaultPluginClass +{ + static function statCompile ($params, $compiler) { + return ''; + } + public function compile ($params, $compiler) { + return ''; + } +} \ No newline at end of file diff --git a/tests/UnitTests/A_Core/LoadPlugin/templates/test_default_compiler_object.tpl b/tests/UnitTests/A_Core/LoadPlugin/templates/test_default_compiler_object.tpl new file mode 100644 index 00000000..62fa3798 --- /dev/null +++ b/tests/UnitTests/A_Core/LoadPlugin/templates/test_default_compiler_object.tpl @@ -0,0 +1 @@ +{compilerobject value='foo bar'} \ No newline at end of file