1
0
mirror of https://github.com/phpbb/phpbb.git synced 2025-02-24 20:13:22 +01:00

[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
This commit is contained in:
Nathaniel Guse 2013-07-01 13:17:59 -05:00
parent 6f925552a5
commit 3060cbe089

View File

@ -14,8 +14,17 @@ class phpbb_template_template_php_test extends phpbb_template_template_test_case
{
public function test_php()
{
$template_text = '<!-- PHP -->echo "test";<!-- ENDPHP -->';
$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');
}
}
}