diff options
author | rxu <rxu@mail.ru> | 2014-02-24 17:05:01 +0800 |
---|---|---|
committer | rxu <rxu@mail.ru> | 2014-03-10 20:59:45 +0800 |
commit | d29514f3e795374a653d3b9fa96c80dbefff449f (patch) | |
tree | 2a05c2eeaa868a40b8048a24249cb5f51237653a /tests | |
parent | dda775c418593c254c463740636dd7fb4d352945 (diff) | |
download | forums-d29514f3e795374a653d3b9fa96c80dbefff449f.tar forums-d29514f3e795374a653d3b9fa96c80dbefff449f.tar.gz forums-d29514f3e795374a653d3b9fa96c80dbefff449f.tar.bz2 forums-d29514f3e795374a653d3b9fa96c80dbefff449f.tar.xz forums-d29514f3e795374a653d3b9fa96c80dbefff449f.zip |
[ticket/12224] Add assign_block_vars_array() test.
Add tests, also change return value to null.
PHPBB3-12224
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 */ |