aboutsummaryrefslogtreecommitdiffstats
path: root/tests
diff options
context:
space:
mode:
Diffstat (limited to 'tests')
-rw-r--r--tests/template/includephp_test.php12
-rw-r--r--tests/template/template_includejs_test.php6
-rw-r--r--tests/template/template_test.php7
-rw-r--r--tests/template/templates/include_variables.html1
-rw-r--r--tests/template/templates/includejs.html4
-rw-r--r--tests/template/templates/includephp_variables.html2
-rw-r--r--tests/template/templates/subdir/parent_only.js0
-rw-r--r--tests/template/templates/subdir/subsubdir/parent_only.js0
-rw-r--r--tests/template/templates/subdir/variable.html1
9 files changed, 30 insertions, 3 deletions
diff --git a/tests/template/includephp_test.php b/tests/template/includephp_test.php
index 626735f15f..236621adec 100644
--- a/tests/template/includephp_test.php
+++ b/tests/template/includephp_test.php
@@ -23,6 +23,18 @@ class phpbb_template_includephp_test extends phpbb_template_template_test_case
$this->assertEquals("Path is relative to board root.\ntesting included php", $this->display('test'), "Testing INCLUDEPHP");
}
+ public function test_includephp_variables()
+ {
+ $this->setup_engine(array('tpl_allow_php' => true));
+
+ $cache_file = $this->template->cachepath . 'includephp_variables.html.php';
+
+ $this->run_template('includephp_variables.html', array('TEMPLATES' => 'templates'), array(), array(), "Path includes variables.\ntesting included php", $cache_file);
+
+ $this->template->set_filenames(array('test' => 'includephp_variables.html'));
+ $this->assertEquals("Path includes variables.\ntesting included php", $this->display('test'), "Testing INCLUDEPHP");
+ }
+
public function test_includephp_absolute()
{
$path_to_php = dirname(__FILE__) . '/templates/_dummy_include.php.inc';
diff --git a/tests/template/template_includejs_test.php b/tests/template/template_includejs_test.php
index a8f9a9037f..d8c7170e94 100644
--- a/tests/template/template_includejs_test.php
+++ b/tests/template/template_includejs_test.php
@@ -20,11 +20,13 @@ class phpbb_template_template_includejs_test extends phpbb_template_template_tes
$scripts = array(
'<script src="' . $this->test_path . '/templates/parent_and_child.js?assets_version=1"></script>',
'<script src="' . $this->test_path . '/parent_templates/parent_only.js?assets_version=1"></script>',
- '<script src="' . $this->test_path . '/templates/child_only.js?assets_version=1"></script>'
+ '<script src="' . $this->test_path . '/templates/child_only.js?assets_version=1"></script>',
+ '<script src="' . $this->test_path . '/templates/subdir/parent_only.js?assets_version=1"></script>',
+ '<script src="' . $this->test_path . '/templates/subdir/subsubdir/parent_only.js?assets_version=1"></script>',
);
// Run test
$cache_file = $this->template->cachepath . 'includejs.html.php';
- $this->run_template('includejs.html', array('PARENT' => 'parent_only.js'), array(), array(), implode('', $scripts), $cache_file);
+ $this->run_template('includejs.html', array('PARENT' => 'parent_only.js', 'SUBDIR' => 'subdir'), array(), array(), implode('', $scripts), $cache_file);
}
}
diff --git a/tests/template/template_test.php b/tests/template/template_test.php
index f8677ed913..83995cb4ac 100644
--- a/tests/template/template_test.php
+++ b/tests/template/template_test.php
@@ -184,6 +184,13 @@ class phpbb_template_template_test extends phpbb_template_template_test_case
'value',
),
array(
+ 'include_variables.html',
+ array('SUBDIR' => 'subdir', 'VARIABLE' => 'value'),
+ array(),
+ array(),
+ 'value',
+ ),
+ array(
'loop_vars.html',
array(),
array('loop' => array(array('VARIABLE' => 'x'), array('VARIABLE' => 'y')), 'loop.inner' => array(array(), array())),
diff --git a/tests/template/templates/include_variables.html b/tests/template/templates/include_variables.html
new file mode 100644
index 0000000000..8371a061b5
--- /dev/null
+++ b/tests/template/templates/include_variables.html
@@ -0,0 +1 @@
+<!-- INCLUDE {SUBDIR}/variable.html -->
diff --git a/tests/template/templates/includejs.html b/tests/template/templates/includejs.html
index 8a2587d76b..dbcf6e04a8 100644
--- a/tests/template/templates/includejs.html
+++ b/tests/template/templates/includejs.html
@@ -2,4 +2,6 @@
<!-- INCLUDEJS {PARENT} -->
<!-- DEFINE $TEST = 'child_only.js' -->
<!-- INCLUDEJS {$TEST} -->
-{SCRIPTS} \ No newline at end of file
+<!-- INCLUDEJS subdir/{PARENT} -->
+<!-- INCLUDEJS {SUBDIR}/subsubdir/{PARENT} -->
+{SCRIPTS}
diff --git a/tests/template/templates/includephp_variables.html b/tests/template/templates/includephp_variables.html
new file mode 100644
index 0000000000..6106efc86a
--- /dev/null
+++ b/tests/template/templates/includephp_variables.html
@@ -0,0 +1,2 @@
+Path includes variables.
+<!-- INCLUDEPHP ../tests/template/{TEMPLATES}/_dummy_include.php.inc -->
diff --git a/tests/template/templates/subdir/parent_only.js b/tests/template/templates/subdir/parent_only.js
new file mode 100644
index 0000000000..e69de29bb2
--- /dev/null
+++ b/tests/template/templates/subdir/parent_only.js
diff --git a/tests/template/templates/subdir/subsubdir/parent_only.js b/tests/template/templates/subdir/subsubdir/parent_only.js
new file mode 100644
index 0000000000..e69de29bb2
--- /dev/null
+++ b/tests/template/templates/subdir/subsubdir/parent_only.js
diff --git a/tests/template/templates/subdir/variable.html b/tests/template/templates/subdir/variable.html
new file mode 100644
index 0000000000..f68f91597c
--- /dev/null
+++ b/tests/template/templates/subdir/variable.html
@@ -0,0 +1 @@
+{VARIABLE}