diff --git a/phpBB/includes/functions_acp.php b/phpBB/includes/functions_acp.php index b9210114ef..cb44ed2794 100644 --- a/phpBB/includes/functions_acp.php +++ b/phpBB/includes/functions_acp.php @@ -363,7 +363,9 @@ function build_cfg_template($tpl_type, $key, &$new, $config_key, $vars) if ($tpl_type[0] == 'select') { - $tpl = ''; + $size = (isset($tpl_type[1])) ? (int) $tpl_type[1] : 1; + + $tpl = ''; } else { 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'), + '', + ), + array( + array('select', 8), + 'key_name', + array('config_key_name' => '1'), + 'config_key_name', + array('method' => 'select_helper'), + '', + ), + ); + } + + /** + * @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' + ); + } }