[ticket/289] Add method for generating select boxes in modules
This commit is contained in:
@@ -43,4 +43,44 @@ class board3_includes_modules_helper_test extends \board3\portal\tests\testframe
|
||||
{
|
||||
$this->assertEquals($expected, $this->modules_helper->get_disallowed_forums($input));
|
||||
}
|
||||
|
||||
public function data_generate_select_box()
|
||||
{
|
||||
return array(
|
||||
array('<select id="foobar" name="foobar[]" multiple="multiple"><option value="one">one</option><option value="two" selected="selected">two</option></select>',
|
||||
'foobar',
|
||||
array(
|
||||
'1' => array(
|
||||
'value' => 'one',
|
||||
'title' => 'one',
|
||||
),
|
||||
'2' => array(
|
||||
'value' => 'two',
|
||||
'title' => 'two',
|
||||
),
|
||||
),
|
||||
array('two')),
|
||||
array('<select id="foobar" name="foobar[]" multiple="multiple"><option value="one" selected="selected">two</option><option value="two">three</option></select>',
|
||||
'foobar',
|
||||
array(
|
||||
'1' => array(
|
||||
'value' => 'one',
|
||||
'title' => 'two',
|
||||
),
|
||||
'2' => array(
|
||||
'value' => 'two',
|
||||
'title' => 'three',
|
||||
),
|
||||
),
|
||||
array('one')),
|
||||
);
|
||||
}
|
||||
|
||||
/**
|
||||
* @dataProvider data_generate_select_box
|
||||
*/
|
||||
public function test_generate_select_box($expected, $key, $select_ary, $selected_options)
|
||||
{
|
||||
$this->assertEquals($expected, $this->modules_helper->generate_select_box($key, $select_ary, $selected_options));
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user