'1'),
'config_key_name',
array(),
'',
),
array(
array('password', 20, 128),
'key_name',
array('config_key_name' => '2'),
'config_key_name',
array(),
'',
),
array(
array('text', 0, 255),
'key_name',
array('config_key_name' => '3'),
'config_key_name',
array(),
'',
),
);
}
/**
* @dataProvider build_cfg_template_text_data
*/
public function test_build_cfg_template_text($tpl_type, $key, $new, $config_key, $vars, $expected)
{
global $user, $phpbb_dispatcher;
$phpbb_dispatcher = new phpbb_mock_event_dispatcher();
$user = new phpbb_mock_user();
$user->lang = new phpbb_mock_lang();
$this->assertEquals($expected, build_cfg_template($tpl_type, $key, $new, $config_key, $vars));
}
public function build_cfg_template_dimension_data()
{
return array(
array(
array('dimension', 5, 15),
'number_key_name',
array('config_key_name_width' => 10, 'config_key_name_height' => 20),
'config_key_name',
array(),
' x ',
),
array(
array('dimension', 0, 15),
'number_key_name',
array('config_key_name_width' => 10, 'config_key_name_height' => 20),
'config_key_name',
array(),
' x ',
),
);
}
/**
* @dataProvider build_cfg_template_dimension_data
*/
public function test_build_cfg_template_dimension($tpl_type, $key, $new, $config_key, $vars, $expected)
{
global $user, $phpbb_dispatcher;
$phpbb_dispatcher = new phpbb_mock_event_dispatcher();
$user = new phpbb_mock_user();
$user->lang = new phpbb_mock_lang();
$this->assertEquals($expected, build_cfg_template($tpl_type, $key, $new, $config_key, $vars));
}
public function build_cfg_template_number_data()
{
return array(
array(
array('number', 5, 15),
'number_key_name',
array('config_key_name' => 10),
'config_key_name',
array(),
'',
),
array(
array('number', -1, 9999),
'number_key_name',
array('config_key_name' => 10),
'config_key_name',
array(),
'',
),
);
}
/**
* @dataProvider build_cfg_template_number_data
*/
public function test_build_cfg_template_number($tpl_type, $key, $new, $config_key, $vars, $expected)
{
global $user, $phpbb_dispatcher;
$phpbb_dispatcher = new phpbb_mock_event_dispatcher();
$user = new phpbb_mock_user();
$user->lang = new phpbb_mock_lang();
$this->assertEquals($expected, build_cfg_template($tpl_type, $key, $new, $config_key, $vars));
}
public function build_cfg_template_textarea_data()
{
return array(
array(
array('textarea', 5, 30),
'key_name',
array('config_key_name' => 'phpBB'),
'config_key_name',
array(),
'',
),
);
}
/**
* @dataProvider build_cfg_template_textarea_data
*/
public function test_build_cfg_template_textarea($tpl_type, $key, $new, $config_key, $vars, $expected)
{
global $user, $phpbb_dispatcher;
$phpbb_dispatcher = new phpbb_mock_event_dispatcher();
$user = new phpbb_mock_user();
$user->lang = new phpbb_mock_lang();
$this->assertEquals($expected, build_cfg_template($tpl_type, $key, $new, $config_key, $vars));
}
public function build_cfg_template_radio_data()
{
return array(
array(
array('radio', 'enabled_disabled'),
'key_name',
array('config_key_name' => '0'),
'config_key_name',
array(),
'',
),
array(
array('radio', 'enabled_disabled'),
'key_name',
array('config_key_name' => '1'),
'config_key_name',
array(),
'',
),
array(
array('radio', 'yes_no'),
'key_name',
array('config_key_name' => '0'),
'config_key_name',
array(),
'',
),
array(
array('radio', 'yes_no'),
'key_name',
array('config_key_name' => '1'),
'config_key_name',
array(),
'',
),
);
}
/**
* @dataProvider build_cfg_template_radio_data
*/
public function test_build_cfg_template_radio($tpl_type, $key, $new, $config_key, $vars, $expected)
{
global $user, $phpbb_dispatcher;
$phpbb_dispatcher = new phpbb_mock_event_dispatcher();
$user = new phpbb_mock_user();
$user->lang = new phpbb_mock_lang();
$this->assertEquals($expected, build_cfg_template($tpl_type, $key, $new, $config_key, $vars));
}
public function build_cfg_template_append_data()
{
return array(
array(
array('textarea', 5, 30),
'key_name',
array('config_key_name' => 'phpBB'),
'config_key_name',
array('append' => 'Bertie is cool!'),
'Bertie is cool!',
),
);
}
/**
* @dataProvider build_cfg_template_append_data
*/
public function test_build_cfg_template_append($tpl_type, $key, $new, $config_key, $vars, $expected)
{
global $user, $phpbb_dispatcher;
$phpbb_dispatcher = new phpbb_mock_event_dispatcher();
$user = new phpbb_mock_user();
$user->lang = new phpbb_mock_lang();
$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'
);
}
}