diff options
author | Nathan Guse <nathaniel.guse@gmail.com> | 2013-12-04 09:48:10 -0800 |
---|---|---|
committer | Nathan Guse <nathaniel.guse@gmail.com> | 2013-12-04 09:48:10 -0800 |
commit | e399a52816c57426de1147d4994df58f4c581313 (patch) | |
tree | 73187fd2203278bd155c7d2758c13748de9ccd34 /tests/functions_acp | |
parent | b474917ba3fbb26e50a7145fa904efec949f20ce (diff) | |
parent | 2f4d15015e7a0e8d8f9a76b60c5c8c0091e399ca (diff) | |
download | forums-e399a52816c57426de1147d4994df58f4c581313.tar forums-e399a52816c57426de1147d4994df58f4c581313.tar.gz forums-e399a52816c57426de1147d4994df58f4c581313.tar.bz2 forums-e399a52816c57426de1147d4994df58f4c581313.tar.xz forums-e399a52816c57426de1147d4994df58f4c581313.zip |
Merge pull request #1887 from nickvergessen/ticket/skouat/10910
[ticket/10910] Function build_cfg_template() allow $size for $tpl_type = select
Diffstat (limited to 'tests/functions_acp')
-rw-r--r-- | tests/functions_acp/build_cfg_template_test.php | 50 |
1 files changed, 50 insertions, 0 deletions
diff --git a/tests/functions_acp/build_cfg_template_test.php b/tests/functions_acp/build_cfg_template_test.php index acf4da1bd6..7f8db799c5 100644 --- a/tests/functions_acp/build_cfg_template_test.php +++ b/tests/functions_acp/build_cfg_template_test.php @@ -234,4 +234,54 @@ class phpbb_functions_acp_build_cfg_template_test extends phpbb_test_case $this->assertEquals($expected, build_cfg_template($tpl_type, $key, $new, $config_key, $vars)); } + + public function build_cfg_template_select_data() + { + return array( + array( + array('select'), + 'key_name', + array('config_key_name' => '0'), + 'config_key_name', + array('method' => 'select_helper'), + '<select id="key_name" name="config[config_key_name]"><option value="1">First_Option</option><option value="2" selected="selected">Second_Option</option><option value="3">Third_Option</option></select>', + ), + array( + array('select', 8), + 'key_name', + array('config_key_name' => '1'), + 'config_key_name', + array('method' => 'select_helper'), + '<select id="key_name" name="config[config_key_name]" size="8"><option value="1">First_Option</option><option value="2" selected="selected">Second_Option</option><option value="3">Third_Option</option></select>', + ), + ); + } + + /** + * @dataProvider build_cfg_template_select_data + */ + public function test_build_cfg_template_select($tpl_type, $key, $new, $config_key, $vars, $expected) + { + global $module, $user, $phpbb_dispatcher; + + $phpbb_dispatcher = new phpbb_mock_event_dispatcher(); + $user = new phpbb_mock_user(); + $user->lang = new phpbb_mock_lang(); + $user->module = $this; + $module = $user; + + $this->assertEquals($expected, build_cfg_template($tpl_type, $key, $new, $config_key, $vars)); + } + + public function select_helper() + { + return build_select( + array( + '1' => 'First_Option', + '2' => 'Second_Option', + '3' => 'Third_Option', + ), + '2' + ); + } } |