mirror of
https://github.com/phpbb/phpbb.git
synced 2025-06-18 17:28:56 +00:00
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
30 lines
814 B
PHP
30 lines
814 B
PHP
<?php
|
|
/**
|
|
*
|
|
* @package testing
|
|
* @copyright (c) 2013 phpBB Group
|
|
* @license http://opensource.org/licenses/gpl-2.0.php GNU General Public License v2
|
|
*
|
|
*/
|
|
|
|
require_once dirname(__FILE__) . '/../../phpBB/includes/functions.php';
|
|
require_once dirname(__FILE__) . '/template_test_case.php';
|
|
|
|
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');
|
|
}
|
|
}
|