aboutsummaryrefslogtreecommitdiffstats
path: root/tests/template
diff options
context:
space:
mode:
authorVjacheslav Trushkin <arty@phpbb.com>2012-03-08 01:01:16 +0200
committerVjacheslav Trushkin <arty@phpbb.com>2012-03-08 01:01:16 +0200
commitebdd03872a9759532805b0319931bb3381ac790f (patch)
tree3a1701fdfac77b28929093c11d2e44bca7fcaeca /tests/template
parenta98117b22967db2c475988a0b271d827cf0f9af6 (diff)
downloadforums-ebdd03872a9759532805b0319931bb3381ac790f.tar
forums-ebdd03872a9759532805b0319931bb3381ac790f.tar.gz
forums-ebdd03872a9759532805b0319931bb3381ac790f.tar.bz2
forums-ebdd03872a9759532805b0319931bb3381ac790f.tar.xz
forums-ebdd03872a9759532805b0319931bb3381ac790f.zip
[feature/append_var] Adding test case
Adding test case for append_var PHPBB3-10666
Diffstat (limited to 'tests/template')
-rw-r--r--tests/template/template_test.php36
1 files changed, 36 insertions, 0 deletions
diff --git a/tests/template/template_test.php b/tests/template/template_test.php
index 419c90bd2a..76b1af68d8 100644
--- a/tests/template/template_test.php
+++ b/tests/template/template_test.php
@@ -347,6 +347,42 @@ class phpbb_template_template_test extends phpbb_template_template_test_case
$this->assertEquals($expected, $this->display('container'), "Testing assign_display($file)");
}
+ public function test_append_var_without_assign_var()
+ {
+ $this->template->set_filenames(array(
+ 'append_var' => 'variable.html'
+ ));
+
+ $items = array('This ', 'is ', 'a ', 'test');
+ $expecting = implode('', $items);
+
+ foreach ($items as $word)
+ {
+ $this->template->append_var('VARIABLE', $word);
+ }
+
+ $this->assertEquals($expecting, $this->display('append_var'));
+ }
+
+ public function test_append_var_with_assign_var()
+ {
+ $this->template->set_filenames(array(
+ 'append_var' => 'variable.html'
+ ));
+
+ $start = 'This ';
+ $items = array('is ', 'a ', 'test');
+ $expecting = $start . implode('', $items);
+
+ $this->template->assign_var('VARIABLE', $start);
+ foreach ($items as $word)
+ {
+ $this->template->append_var('VARIABLE', $word);
+ }
+
+ $this->assertEquals($expecting, $this->display('append_var'));
+ }
+
public function test_php()
{
$this->setup_engine(array('tpl_allow_php' => true));