diff options
author | javiexin <javiexin@gmail.com> | 2017-01-07 20:12:32 +0100 |
---|---|---|
committer | javiexin <javiexin@gmail.com> | 2017-01-07 20:12:32 +0100 |
commit | 76b3fbc00669ca5d23255229b523cfa8e10c19bb (patch) | |
tree | b99662e4fbc2bb960baebe1136c82d7ab4b75ab8 /tests/template/template_test.php | |
parent | c40642b8274c9afa39af6b34cd831bed8b960b83 (diff) | |
download | forums-76b3fbc00669ca5d23255229b523cfa8e10c19bb.tar forums-76b3fbc00669ca5d23255229b523cfa8e10c19bb.tar.gz forums-76b3fbc00669ca5d23255229b523cfa8e10c19bb.tar.bz2 forums-76b3fbc00669ca5d23255229b523cfa8e10c19bb.tar.xz forums-76b3fbc00669ca5d23255229b523cfa8e10c19bb.zip |
[ticket/14943] Fix template loop access by index
Allows inserting elements in a loop specified as 'outer[3].inner'.
This was coded, but malfunctioning. Name incorrectly set on insert.
Added more tests.
PHPBB3-14943
Diffstat (limited to 'tests/template/template_test.php')
-rw-r--r-- | tests/template/template_test.php | 10 |
1 files changed, 10 insertions, 0 deletions
diff --git a/tests/template/template_test.php b/tests/template/template_test.php index 92de5d3fac..7231f71511 100644 --- a/tests/template/template_test.php +++ b/tests/template/template_test.php @@ -718,6 +718,16 @@ EOT $expect = 'outer - 0[outer|4]outer - 1[outer|4]middle - 0[middle|1]outer - 2 - test[outer|4]middle - 0[middle|2]middle - 1[middle|2]outer - 3[outer|4]middle - 0[middle|3]middle - 1[middle|3]middle - 2[middle|3]'; $this->assertEquals($expect, str_replace(array("\n", "\r", "\t"), '', $this->display('test')), 'Ensuring S_NUM_ROWS is correct after modification'); + + $this->template->alter_block_array('outer.middle', array()); + + $expect = 'outer - 0[outer|4]outer - 1[outer|4]middle - 0[middle|1]outer - 2 - test[outer|4]middle - 0[middle|2]middle - 1[middle|2]outer - 3[outer|4]middle - 0[middle|4]middle - 1[middle|4]middle - 2[middle|4]middle - 3[middle|4]'; + $this->assertEquals($expect, str_replace(array("\n", "\r", "\t"), '', $this->display('test')), 'Ensuring S_NUM_ROWS is correct after insertion at middle level'); + + $this->template->alter_block_array('outer.middle', array('VARIABLE' => 'test'), 2, 'change'); + + $expect = 'outer - 0[outer|4]outer - 1[outer|4]middle - 0[middle|1]outer - 2 - test[outer|4]middle - 0[middle|2]middle - 1[middle|2]outer - 3[outer|4]middle - 0[middle|4]middle - 1[middle|4]middle - 2 - test[middle|4]middle - 3[middle|4]'; + $this->assertEquals($expect, str_replace(array("\n", "\r", "\t"), '', $this->display('test')), 'Ensuring S_NUM_ROWS is correct after modification at middle level'); } public function assign_block_vars_array_data() |