From 7e20b711806abf247209ea0211a45a8083f6ad3b Mon Sep 17 00:00:00 2001 From: Nathaniel Guse Date: Fri, 12 Jul 2013 11:47:34 -0500 Subject: [PATCH 1/2] [ticket/11665] Can't change file names already sent to set_filenames PHPBB3-11665 --- phpBB/includes/template/twig/twig.php | 2 +- tests/template/template_parser_test.php | 29 +++++++++++++++++++++++++ 2 files changed, 30 insertions(+), 1 deletion(-) create mode 100644 tests/template/template_parser_test.php diff --git a/phpBB/includes/template/twig/twig.php b/phpBB/includes/template/twig/twig.php index f5638972a3..92a37d1634 100644 --- a/phpBB/includes/template/twig/twig.php +++ b/phpBB/includes/template/twig/twig.php @@ -172,7 +172,7 @@ class phpbb_template_twig implements phpbb_template */ public function set_filenames(array $filename_array) { - $this->filenames = array_merge($filename_array, $this->filenames); + $this->filenames = array_merge($this->filenames, $filename_array); return $this; } diff --git a/tests/template/template_parser_test.php b/tests/template/template_parser_test.php new file mode 100644 index 0000000000..aa7a9412d6 --- /dev/null +++ b/tests/template/template_parser_test.php @@ -0,0 +1,29 @@ +template->set_filenames(array( + 'basic' => 'basic.html', + )); + + $this->assertEquals("passpasspass", str_replace(array("\n", "\r", "\t"), '', $this->template->assign_display('basic'))); + + $this->template->set_filenames(array( + 'basic' => 'if.html', + )); + + $this->assertEquals("03!false", str_replace(array("\n", "\r", "\t"), '', $this->template->assign_display('basic'))); + } +} From 27b550ae66ccc3257eea92a8f7b96e3d9c729a4c Mon Sep 17 00:00:00 2001 From: Nathaniel Guse Date: Fri, 12 Jul 2013 12:10:57 -0500 Subject: [PATCH 2/2] [ticket/11665] Fix test class name PHPBB3-11665 --- tests/template/template_parser_test.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/tests/template/template_parser_test.php b/tests/template/template_parser_test.php index aa7a9412d6..c200770adf 100644 --- a/tests/template/template_parser_test.php +++ b/tests/template/template_parser_test.php @@ -10,7 +10,7 @@ require_once dirname(__FILE__) . '/../../phpBB/includes/functions.php'; require_once dirname(__FILE__) . '/template_test_case.php'; -class phpbb_template_template_test extends phpbb_template_template_test_case +class phpbb_template_template_parser_test extends phpbb_template_template_test_case { public function test_set_filenames() {