aboutsummaryrefslogtreecommitdiffstats
path: root/tests/template/subdir
diff options
context:
space:
mode:
authorOleg Pudeyev <oleg@bsdpower.com>2011-05-13 10:46:10 -0400
committerOleg Pudeyev <oleg@bsdpower.com>2011-05-14 15:30:20 -0400
commitbe8fc0864c005e7240ba28b24de317a969c7f9b6 (patch)
tree829954f0714a98dff0b20a8284288351c8a43e71 /tests/template/subdir
parent94560d708649df876f8486d4ba5361475037f1ff (diff)
downloadforums-be8fc0864c005e7240ba28b24de317a969c7f9b6.tar
forums-be8fc0864c005e7240ba28b24de317a969c7f9b6.tar.gz
forums-be8fc0864c005e7240ba28b24de317a969c7f9b6.tar.bz2
forums-be8fc0864c005e7240ba28b24de317a969c7f9b6.tar.xz
forums-be8fc0864c005e7240ba28b24de317a969c7f9b6.zip
[feature/template-engine] Added a test for inclusion of php files from subdir.
PHPBB3-9726
Diffstat (limited to 'tests/template/subdir')
-rw-r--r--tests/template/subdir/includephp_from_subdir_test.php33
1 files changed, 33 insertions, 0 deletions
diff --git a/tests/template/subdir/includephp_from_subdir_test.php b/tests/template/subdir/includephp_from_subdir_test.php
new file mode 100644
index 0000000000..7bfd852d9e
--- /dev/null
+++ b/tests/template/subdir/includephp_from_subdir_test.php
@@ -0,0 +1,33 @@
+<?php
+/**
+*
+* @package testing
+* @copyright (c) 2011 phpBB Group
+* @license http://opensource.org/licenses/gpl-license.php GNU Public License
+*
+*/
+
+require_once dirname(__FILE__) . '/../../../phpBB/includes/functions.php';
+require_once dirname(__FILE__) . '/../../../phpBB/includes/template.php';
+require_once dirname(__FILE__) . '/../template_test_case.php';
+
+class phpbb_template_subdir_includephp_from_subdir_test extends phpbb_template_template_test_case
+{
+ // Exact copy of test_includephp_relatve from ../template_test.php.
+ // Verifies that relative php inclusion works when including script
+ // (and thus current working directory) is in a subdirectory of
+ // board root.
+ public function test_includephp_relative()
+ {
+ $GLOBALS['config']['tpl_allow_php'] = true;
+
+ $cache_file = $this->template->cachepath . 'includephp_relative.html.php';
+
+ $this->run_template('includephp_relative.html', array(), array(), array(), "Path is relative to board root.\ntesting included php", $cache_file);
+
+ $this->template->set_filenames(array('test' => 'includephp_relative.html'));
+ $this->assertEquals("Path is relative to board root.\ntesting included php", $this->display('test'), "Testing INCLUDEPHP");
+
+ $GLOBALS['config']['tpl_allow_php'] = false;
+ }
+}