phpbb/tests/template/renderer_eval_test.php
Vjacheslav Trushkin d8f4f92dae [ticket/10350] Script for testing eval renderer
Script for testing eval renderer (fixed)

PHPBB3-10350
2011-09-05 11:57:18 +03:00

31 lines
677 B
PHP

<?php
/**
*
* @package testing
* @copyright (c) 2011 phpBB Group
* @license http://opensource.org/licenses/gpl-license.php GNU Public License
*
*/
class phpbb_template_renderer_eval_test extends phpbb_test_case
{
public function test_eval()
{
$compiled_code = '<a href="<?php echo \'Test\'; ?>">';
$valid_code = '<a href="Test">';
$context = new phpbb_template_context();
$template = new phpbb_template_renderer_eval($compiled_code, NULL);
ob_start();
try
{
$template->render($context, array());
}
catch (Exception $exception)
{
ob_end_clean();
throw $exception;
}
$output = ob_get_clean();
$this->assertEquals($valid_code, $output);
}
}