1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
|
<?php
/**
*
* @package testing
* @copyright (c) 2010 phpBB Group
* @license http://opensource.org/licenses/gpl-2.0.php GNU General Public License v2
*
*/
require_once dirname(__FILE__) . '/../../phpBB/includes/functions_acp.php';
class phpbb_functions_acp_h_radio_test extends phpbb_test_case
{
protected function setUp()
{
parent::setUp();
global $user;
$user = new phpbb_mock_user();
$user->lang = new phpbb_mock_lang();
}
public function h_radio_data()
{
return array(
array(
'test_name',
array(
'test' => 'TEST',
'second' => 'SEC_OPTION',
),
false,
false,
false,
'<label><input type="radio" name="test_name" value="test" class="radio" /> TEST</label><label><input type="radio" name="test_name" value="second" class="radio" /> SEC_OPTION</label>',
),
array(
'test_name',
array(
'test' => 'TEST',
'second' => 'SEC_OPTION',
),
'test',
false,
false,
'<label><input type="radio" name="test_name" value="test" checked="checked" class="radio" /> TEST</label><label><input type="radio" name="test_name" value="second" class="radio" /> SEC_OPTION</label>',
),
array(
'test_name',
array(
'test' => 'TEST',
'second' => 'SEC_OPTION',
),
false,
'test_id',
false,
'<label><input type="radio" name="test_name" id="test_id" value="test" class="radio" /> TEST</label><label><input type="radio" name="test_name" value="second" class="radio" /> SEC_OPTION</label>',
),
array(
'test_name',
array(
'test' => 'TEST',
'second' => 'SEC_OPTION',
),
'test',
'test_id',
false,
'<label><input type="radio" name="test_name" id="test_id" value="test" checked="checked" class="radio" /> TEST</label><label><input type="radio" name="test_name" value="second" class="radio" /> SEC_OPTION</label>',
),
array(
'test_name',
array(
'test' => 'TEST',
'second' => 'SEC_OPTION',
),
false,
false,
'k',
'<label><input type="radio" name="test_name" value="test" accesskey="k" class="radio" /> TEST</label><label><input type="radio" name="test_name" value="second" accesskey="k" class="radio" /> SEC_OPTION</label>',
),
array(
'test_name',
array(
'test' => 'TEST',
'second' => 'SEC_OPTION',
),
'test',
false,
'k',
'<label><input type="radio" name="test_name" value="test" checked="checked" accesskey="k" class="radio" /> TEST</label><label><input type="radio" name="test_name" value="second" accesskey="k" class="radio" /> SEC_OPTION</label>',
),
array(
'test_name',
array(
'test' => 'TEST',
'second' => 'SEC_OPTION',
),
false,
'test_id',
'k',
'<label><input type="radio" name="test_name" id="test_id" value="test" accesskey="k" class="radio" /> TEST</label><label><input type="radio" name="test_name" value="second" accesskey="k" class="radio" /> SEC_OPTION</label>',
),
array(
'test_name',
array(
'test' => 'TEST',
'second' => 'SEC_OPTION',
),
'test',
'test_id',
'k',
'<label><input type="radio" name="test_name" id="test_id" value="test" checked="checked" accesskey="k" class="radio" /> TEST</label><label><input type="radio" name="test_name" value="second" accesskey="k" class="radio" /> SEC_OPTION</label>',
),
);
}
/**
* @dataProvider h_radio_data
*/
public function test_h_radio($name, $input_ary, $input_default, $id, $key, $expected)
{
$this->assertEquals($expected, h_radio($name, $input_ary, $input_default, $id, $key));
}
}
|