diff options
author | Joas Schilling <nickvergessen@gmx.de> | 2014-03-10 23:49:37 +0100 |
---|---|---|
committer | Joas Schilling <nickvergessen@gmx.de> | 2014-03-10 23:49:37 +0100 |
commit | 235f7c3721f792e0f732ed086e1118a2f08e37a6 (patch) | |
tree | a8e34772c5f685b6b0ba3dc1e7b90c6db2f8457e /tests | |
parent | c169583dc3c551bc08fc217e0d5bb5dd6022ec57 (diff) | |
parent | d29514f3e795374a653d3b9fa96c80dbefff449f (diff) | |
download | forums-235f7c3721f792e0f732ed086e1118a2f08e37a6.tar forums-235f7c3721f792e0f732ed086e1118a2f08e37a6.tar.gz forums-235f7c3721f792e0f732ed086e1118a2f08e37a6.tar.bz2 forums-235f7c3721f792e0f732ed086e1118a2f08e37a6.tar.xz forums-235f7c3721f792e0f732ed086e1118a2f08e37a6.zip |
Merge remote-tracking branch 'rxu3/ticket/12224' into develop
* rxu3/ticket/12224:
[ticket/12224] Add assign_block_vars_array() test.
[ticket/12224] Add template wrapper method to assign block arrays
Diffstat (limited to 'tests')
-rw-r--r-- | tests/template/template_test.php | 34 |
1 files changed, 34 insertions, 0 deletions
diff --git a/tests/template/template_test.php b/tests/template/template_test.php index 6e9b7d3ee9..aaf55fd15c 100644 --- a/tests/template/template_test.php +++ b/tests/template/template_test.php @@ -562,6 +562,40 @@ EOT $this->assertEquals($expect, str_replace(array("\n", "\r", "\t"), '', $this->display('test')), 'Ensuring S_NUM_ROWS is correct after modification'); } + public function assign_block_vars_array_data() + { + return array( + array( + array( + 'outer' => array( + array('VARIABLE' => 'Test assigning block vars array loop 0:'), + array('VARIABLE' => 'Test assigning block vars array loop 1:'), + ), + 'outer.middle' => array( + array('VARIABLE' => '1st iteration',), + array('VARIABLE' => '2nd iteration',), + array('VARIABLE' => '3rd iteration',), + ), + ) + ) + ); + } + + /** + * @dataProvider assign_block_vars_array_data + */ + public function test_assign_block_vars_array($block_data) + { + $this->template->set_filenames(array('test' => 'loop_nested.html')); + + foreach ($block_data as $blockname => $block_vars_array) + { + $this->template->assign_block_vars_array($blockname, $block_vars_array); + } + + $this->assertEquals("outer - 0 - Test assigning block vars array loop 0:outer - 1 - Test assigning block vars array loop 1:middle - 0 - 1st iterationmiddle - 1 - 2nd iterationmiddle - 2 - 3rd iteration", $this->display('test'), 'Ensuring assigning block vars array to template is working correctly'); + } + /** * @expectedException Twig_Error_Syntax */ |