aboutsummaryrefslogtreecommitdiffstats
path: root/tests
diff options
context:
space:
mode:
authorOleg Pudeyev <oleg@bsdpower.com>2011-05-19 12:18:16 -0400
committerOleg Pudeyev <oleg@bsdpower.com>2011-05-19 12:18:16 -0400
commit6ae5a64f6c12937367ad56cac5e38104b445c780 (patch)
treeab59d96e0fab54b90c79e87ac092aba65231fa61 /tests
parentefda4da19fedd0e5bd67835034cfc689b8f5a740 (diff)
downloadforums-6ae5a64f6c12937367ad56cac5e38104b445c780.tar
forums-6ae5a64f6c12937367ad56cac5e38104b445c780.tar.gz
forums-6ae5a64f6c12937367ad56cac5e38104b445c780.tar.bz2
forums-6ae5a64f6c12937367ad56cac5e38104b445c780.tar.xz
forums-6ae5a64f6c12937367ad56cac5e38104b445c780.zip
[feature/template-engine] Fixed absolute path PHP includes, added test.
PHPBB3-9726
Diffstat (limited to 'tests')
-rw-r--r--tests/template/includephp_test.php24
1 files changed, 24 insertions, 0 deletions
diff --git a/tests/template/includephp_test.php b/tests/template/includephp_test.php
index 6c1cdb0fd6..45dc8dc39e 100644
--- a/tests/template/includephp_test.php
+++ b/tests/template/includephp_test.php
@@ -24,4 +24,28 @@ class phpbb_template_includephp_test extends phpbb_template_template_test_case
$GLOBALS['config']['tpl_allow_php'] = false;
}
+
+ public function test_includephp_absolute()
+ {
+ $path_to_php = dirname(__FILE__) . '/templates/_dummy_include.php.inc';
+ $this->assertTrue(is_absolute($path_to_php));
+ $template_text = "Path is absolute.\n<!-- INCLUDEPHP $path_to_php -->";
+
+ $cache_dir = dirname($this->template->cachepath) . '/';
+ $fp = fopen($cache_dir . 'includephp_absolute.html', 'w');
+ fputs($fp, $template_text);
+ fclose($fp);
+
+ $GLOBALS['config']['tpl_allow_php'] = true;
+
+ $this->template->set_custom_template($cache_dir, 'tests');
+ $cache_file = $this->template->cachepath . 'includephp_absolute.html.php';
+
+ $this->run_template('includephp_absolute.html', array(), array(), array(), "Path is absolute.\ntesting included php", $cache_file);
+
+ $this->template->set_filenames(array('test' => 'includephp_absolute.html'));
+ $this->assertEquals("Path is absolute.\ntesting included php", $this->display('test'), "Testing INCLUDEPHP");
+
+ $GLOBALS['config']['tpl_allow_php'] = false;
+ }
}