From 3060cbe089fcb99ee3e7d66fe5b0e4bce171a88a Mon Sep 17 00:00:00 2001 From: Nathaniel Guse Date: Mon, 1 Jul 2013 13:17:59 -0500 Subject: [PATCH] [feature/twig] Fix template/template_php_test.php Must create a template file in the cache to load as this causes errors otherwise. The problem was that Twig builds template files into classes, which are always stored in PHP memory after being loaded. Because of this, Twig would never recompile a template that was already compiled on the same page load (so switching enable PHP on/off in two tests would not work). PHPBB3-11598 --- tests/template/template_php_test.php | 11 ++++++++++- 1 file changed, 10 insertions(+), 1 deletion(-) diff --git a/tests/template/template_php_test.php b/tests/template/template_php_test.php index 9b5e855757..fd4174953c 100644 --- a/tests/template/template_php_test.php +++ b/tests/template/template_php_test.php @@ -14,8 +14,17 @@ class phpbb_template_template_php_test extends phpbb_template_template_test_case { public function test_php() { + $template_text = 'echo "test";'; + + $cache_dir = dirname($this->template->cachepath) . '/'; + $fp = fopen($cache_dir . 'php.html', 'w'); + fputs($fp, $template_text); + fclose($fp); + $this->setup_engine(array('tpl_allow_php' => true)); + $this->style->set_custom_style('tests', $cache_dir, array(), ''); + $this->run_template('php.html', array(), array(), array(), 'test'); } -} \ No newline at end of file +}