From ae53623230a45eeedf50cc3f6220164d8cd256c3 Mon Sep 17 00:00:00 2001 From: Igor Wiedler Date: Sun, 10 Jul 2011 00:35:07 +0200 Subject: [feature/template-engine] Refactor $config dependency out of the filter The template stream filter no longer depends on the $config global. Instead it uses a 'allow_php' param that is passed via stream_bucket_append's last argument. Tests also adjusted. PHPBB3-9726 --- tests/template/template_test_case.php | 16 ++++++++++------ 1 file changed, 10 insertions(+), 6 deletions(-) (limited to 'tests/template/template_test_case.php') diff --git a/tests/template/template_test_case.php b/tests/template/template_test_case.php index cab1aa3d4f..ed5afdc643 100644 --- a/tests/template/template_test_case.php +++ b/tests/template/template_test_case.php @@ -29,9 +29,16 @@ class phpbb_template_template_test_case extends phpbb_test_case return str_replace("\n\n", "\n", implode("\n", array_map('trim', explode("\n", trim($result))))); } - protected function setup_engine() + protected function setup_engine(array $new_config = array()) { - global $phpbb_root_path, $phpEx, $config, $user; + global $phpbb_root_path, $phpEx, $user; + + $defaults = array( + 'load_tplcompile' => true, + 'tpl_allow_php' => false, + ); + + $config = new phpbb_config(array_merge($defaults, $new_config)); $this->template_path = dirname(__FILE__) . '/templates'; $this->template = new phpbb_template($phpbb_root_path, $phpEx, $config, $user); @@ -53,10 +60,7 @@ class phpbb_template_template_test_case extends phpbb_test_case unlink($file); } - $GLOBALS['config'] = array( - 'load_tplcompile' => true, - 'tpl_allow_php' => false, - ); + $this->setup_engine(); } protected function tearDown() -- cgit v1.2.1