[ticket/10910] Function build_cfg_template() allow $size for $tpl_type = select#1317
[ticket/10910] Function build_cfg_template() allow $size for $tpl_type = select#1317Skouat wants to merge 2 commits into
Conversation
|
Please add unit tests to "tests/functions_acp/build_cfg_template_test.php". |
|
Please remove the " for phpBB 3.1.x" from the last line of the commit message. |
|
Hi bantu, It's my first PR and i'm not familiar with GitHub and your process For your first comment, do I create two functions on the basis of existing ones? For your second comment, how can I edit the commit message? Regards. |
If you are using the command line, you can do an interactive rebase like so: |
…e = select PHPBB-10910
|
Thanks imkingdavid. It only remains to add the unit tests. |
|
Hi guys ! I don't know if i've well coded for the test unit. So, here is the code and let me know if this is right or wrong. Regards. public function build_cfg_template_select_data()
{
return array(
array(
array('select', 3),
'key_name',
array('config_key_name' => '2'),
'config_key_name',
array(),
'<select name="config[config_key_name]" id="key_name" size="3"><option value="1">First_Option</option><option value="2" selected="selected">Second_Option</option><option value="3">Third_Option</option></select>',
),
array(
'select',
'key_name',
array('config_key_name' => '2'),
'config_key_name',
array(),
'<select name="config[config_key_name]" id="key_name"><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 $user, $phpbb_dispatcher;
$phpbb_dispatcher = new phpbb_mock_event_dispatcher();
$user->lang = new phpbb_mock_lang();
$this->assertEquals($expected, build_cfg_template($tpl_type, $key, $new, $config_key, $vars));
} |
|
In the second case, you need to replace Also while at it, I'd like to add multiple support here. But adding the tests is not so easy btw, but I will help you with that, when you implemented the multiple support |
Indeed, adding the test units is not so easy. I've tried, i've failed :)
Given my level of coding, it is not easy. But i'm working on it. Regards |
|
Replaced by #1887 |
Function build_cfg_template() allow $size for $tpl_type = select
_How to use it ?_
In ACP file (eg: includes/acp/acp_foo.php) use the select type as below :
For example define the size to 8
After, on submit, we check if no value is selected by using the following code
Ticket PHPBB3-10910