From 4c50a35b62a46de69b439f9ac8007721d76881b0 Mon Sep 17 00:00:00 2001
From: Marc Alexander <admin@m-a-styles.de>
Date: Mon, 14 Jan 2013 01:14:29 +0100
Subject: [PATCH] [ticket/11323] Add tests for inclusion of defined variables

This adds 2 tests for the template engine. The test using
include_define_variable.html will test if a defined variable, which was
defined with another template variable, can be used to include a file.
The second test will do the same inside a loop using a loop variable.

PHPBB3-11323
---
 tests/template/template_test.php                | 17 ++++++++++++++++-
 .../templates/include_define_variable.html      |  2 ++
 .../template/templates/include_loop_define.html |  4 ++++
 3 files changed, 22 insertions(+), 1 deletion(-)
 create mode 100644 tests/template/templates/include_define_variable.html
 create mode 100644 tests/template/templates/include_loop_define.html

diff --git a/tests/template/template_test.php b/tests/template/template_test.php
index 9b3c6ac245..291b424bdd 100644
--- a/tests/template/template_test.php
+++ b/tests/template/template_test.php
@@ -238,7 +238,22 @@ class phpbb_template_template_test extends phpbb_test_case
 				array('loop' => array(array('VARIABLE' => 'x'), array('VARIABLE' => 'y')), 'loop.inner' => array(array(), array())),
 				array('loop'),
 				'',
-			),/* no top level nested loops
+			),
+			array(
+				'include_define_variable.html',
+				array('VARIABLE' => 'variable.html'),
+				array(),
+				array(),
+				'variable.html',
+			),
+			array(
+				'include_loop_define.html',
+				array('VARIABLE' => 'value'),
+				array('loop' => array(array('NESTED_FILE' => 'variable.html'))),
+				array(),
+				'value',
+			),
+			/* no top level nested loops
 			array(
 				'loop_vars.html',
 				array(),
diff --git a/tests/template/templates/include_define_variable.html b/tests/template/templates/include_define_variable.html
new file mode 100644
index 0000000000..aff9b574c2
--- /dev/null
+++ b/tests/template/templates/include_define_variable.html
@@ -0,0 +1,2 @@
+<!-- DEFINE $DEF = '{VARIABLE}' -->
+<!-- INCLUDE {$DEF} -->
diff --git a/tests/template/templates/include_loop_define.html b/tests/template/templates/include_loop_define.html
new file mode 100644
index 0000000000..f539b21396
--- /dev/null
+++ b/tests/template/templates/include_loop_define.html
@@ -0,0 +1,4 @@
+<!-- BEGIN loop -->
+<!-- DEFINE $DEF = '{loop.NESTED_FILE}' -->
+<!-- INCLUDE {$DEF} -->
+<!-- END loop -->