Skip to content

Commit b6e7308

Browse files
committed
tests: POST data are only strings
1 parent f85c2ec commit b6e7308

11 files changed

+32
-32
lines changed

tests/Forms/Controls.Checkbox.loadData.phpt

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,7 @@ before(function () {
2222
test('', function () {
2323
$_POST = [
2424
'off' => '',
25-
'on' => 1,
25+
'on' => '1',
2626
];
2727

2828
$form = new Form;
@@ -39,7 +39,7 @@ test('', function () {
3939

4040

4141
test('malformed data', function () {
42-
$_POST = ['malformed' => [null]];
42+
$_POST = ['malformed' => ['']];
4343

4444
$form = new Form;
4545
$input = $form->addCheckbox('malformed');

tests/Forms/Controls.CheckboxList.loadData.phpt

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -56,7 +56,7 @@ test('compact mode', function () use ($series) {
5656

5757

5858
test('multiple selected items, zero item', function () use ($series) {
59-
$_POST = ['multi' => ['red-dwarf', 'unknown', 0]];
59+
$_POST = ['multi' => ['red-dwarf', 'unknown', '0']];
6060

6161
$form = new Form;
6262
$input = $form->addCheckboxList('multi', null, $series);
@@ -106,7 +106,7 @@ test('disabled key', function () use ($series) {
106106

107107

108108
test('malformed data', function () use ($series) {
109-
$_POST = ['malformed' => [[null]]];
109+
$_POST = ['malformed' => [['']]];
110110

111111
$form = new Form;
112112
$input = $form->addCheckboxList('malformed', null, $series);
@@ -119,7 +119,7 @@ test('malformed data', function () use ($series) {
119119

120120

121121
test('validateLength', function () use ($series) {
122-
$_POST = ['multi' => ['red-dwarf', 'unknown', 0]];
122+
$_POST = ['multi' => ['red-dwarf', 'unknown', '0']];
123123

124124
$form = new Form;
125125
$input = $form->addCheckboxList('multi', null, $series);
@@ -132,7 +132,7 @@ test('validateLength', function () use ($series) {
132132

133133

134134
test('validateEqual', function () use ($series) {
135-
$_POST = ['multi' => ['red-dwarf', 'unknown', 0]];
135+
$_POST = ['multi' => ['red-dwarf', 'unknown', '0']];
136136

137137
$form = new Form;
138138
$input = $form->addCheckboxList('multi', null, $series);
@@ -175,7 +175,7 @@ test('object as item', function () {
175175

176176

177177
test('disabled one', function () use ($series) {
178-
$_POST = ['list' => ['red-dwarf', 0]];
178+
$_POST = ['list' => ['red-dwarf', '0']];
179179

180180
$form = new Form;
181181
$input = $form->addCheckboxList('list', null, $series)

tests/Forms/Controls.ChoiceControl.loadData.phpt

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -60,7 +60,7 @@ test('Select with invalid input', function () use ($series) {
6060

6161

6262
test('Indexed arrays', function () use ($series) {
63-
$_POST = ['zero' => 0];
63+
$_POST = ['zero' => '0'];
6464

6565
$form = new Form;
6666
$input = $form['zero'] = new ChoiceControl(null, $series);
@@ -111,7 +111,7 @@ test('disabled key', function () use ($series) {
111111

112112

113113
test('malformed data', function () use ($series) {
114-
$_POST = ['malformed' => [null]];
114+
$_POST = ['malformed' => ['']];
115115

116116
$form = new Form;
117117
$input = $form['malformed'] = new ChoiceControl(null, $series);
@@ -200,7 +200,7 @@ test('disabled one', function () use ($series) {
200200
});
201201

202202
test('', function () {
203-
$_POST = ['select' => 1];
203+
$_POST = ['select' => '1'];
204204

205205
$form = new Form;
206206
$input = $form['select'] = new ChoiceControl(null);

tests/Forms/Controls.HiddenField.loadData.phpt

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -37,7 +37,7 @@ test('', function () {
3737

3838

3939
test('invalid data', function () {
40-
$_POST = ['malformed' => [null]];
40+
$_POST = ['malformed' => ['']];
4141
$form = new Form;
4242
$input = $form->addHidden('malformed');
4343
Assert::same('', $input->getValue());

tests/Forms/Controls.ImageButton.loadData.phpt

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -21,9 +21,9 @@ before(function () {
2121

2222
test('', function () {
2323
$_POST = [
24-
'image' => [1, 2],
24+
'image' => ['1', '2'],
2525
'container' => [
26-
'image' => [3, 4],
26+
'image' => ['3', '4'],
2727
],
2828
];
2929

@@ -47,8 +47,8 @@ test('missing data', function () {
4747

4848
test('malformed data', function () {
4949
$_POST = [
50-
'malformed1' => [1],
51-
'malformed2' => [[null]],
50+
'malformed1' => ['1'],
51+
'malformed2' => [['']],
5252
];
5353

5454
$form = new Form;

tests/Forms/Controls.MultiChoiceControl.loadData.phpt

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -48,7 +48,7 @@ test('invalid input', function () use ($series) {
4848

4949

5050
test('multiple selected items, zero item', function () use ($series) {
51-
$_POST = ['multi' => ['red-dwarf', 'unknown', 0]];
51+
$_POST = ['multi' => ['red-dwarf', 'unknown', '0']];
5252

5353
$form = new Form;
5454
$input = $form['multi'] = new MultiChoiceControl(null, $series);
@@ -98,7 +98,7 @@ test('disabled key', function () use ($series) {
9898

9999

100100
test('malformed data', function () use ($series) {
101-
$_POST = ['malformed' => [[null]]];
101+
$_POST = ['malformed' => [['']]];
102102

103103
$form = new Form;
104104
$input = $form['malformed'] = new MultiChoiceControl(null, $series);
@@ -131,7 +131,7 @@ test('setItems without keys', function () use ($series) {
131131

132132

133133
test('validateLength', function () use ($series) {
134-
$_POST = ['multi' => ['red-dwarf', 'unknown', 0]];
134+
$_POST = ['multi' => ['red-dwarf', 'unknown', '0']];
135135

136136
$form = new Form;
137137
$input = $form['multi'] = new MultiChoiceControl(null, $series);
@@ -144,7 +144,7 @@ test('validateLength', function () use ($series) {
144144

145145

146146
test('validateEqual', function () use ($series) {
147-
$_POST = ['multi' => ['red-dwarf', 'unknown', 0]];
147+
$_POST = ['multi' => ['red-dwarf', 'unknown', '0']];
148148

149149
$form = new Form;
150150
$input = $form['multi'] = new MultiChoiceControl(null, $series);
@@ -202,7 +202,7 @@ test('object as value', function () {
202202

203203

204204
test('disabled one', function () use ($series) {
205-
$_POST = ['select' => ['red-dwarf', 0]];
205+
$_POST = ['select' => ['red-dwarf', '0']];
206206

207207
$form = new Form;
208208
$input = $form['select'] = new MultiChoiceControl(null, $series);

tests/Forms/Controls.MultiSelectBox.loadData.phpt

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -64,7 +64,7 @@ test('invalid input', function () use ($series) {
6464

6565

6666
test('multiple selected items, zero item', function () use ($series) {
67-
$_POST = ['multi' => ['red-dwarf', 'unknown', 0]];
67+
$_POST = ['multi' => ['red-dwarf', 'unknown', '0']];
6868

6969
$form = new Form;
7070
$input = $form->addMultiSelect('multi', null, $series);
@@ -114,7 +114,7 @@ test('disabled key', function () use ($series) {
114114

115115

116116
test('malformed data', function () use ($series) {
117-
$_POST = ['malformed' => [[null]]];
117+
$_POST = ['malformed' => [['']]];
118118

119119
$form = new Form;
120120
$input = $form->addMultiSelect('malformed', null, $series);
@@ -127,7 +127,7 @@ test('malformed data', function () use ($series) {
127127

128128

129129
test('validateLength', function () use ($series) {
130-
$_POST = ['multi' => ['red-dwarf', 'unknown', 0]];
130+
$_POST = ['multi' => ['red-dwarf', 'unknown', '0']];
131131

132132
$form = new Form;
133133
$input = $form->addMultiSelect('multi', null, $series);
@@ -140,7 +140,7 @@ test('validateLength', function () use ($series) {
140140

141141

142142
test('validateEqual', function () use ($series) {
143-
$_POST = ['multi' => ['red-dwarf', 'unknown', 0]];
143+
$_POST = ['multi' => ['red-dwarf', 'unknown', '0']];
144144

145145
$form = new Form;
146146
$input = $form->addMultiSelect('multi', null, $series);
@@ -228,7 +228,7 @@ test('object as item', function () {
228228

229229

230230
test('disabled one', function () use ($series) {
231-
$_POST = ['select' => ['red-dwarf', 0]];
231+
$_POST = ['select' => ['red-dwarf', '0']];
232232

233233
$form = new Form;
234234
$input = $form->addMultiSelect('select', null, $series)

tests/Forms/Controls.RadioList.loadData.phpt

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -55,7 +55,7 @@ test('Radio list with invalid input', function () use ($series) {
5555

5656

5757
test('Indexed arrays', function () use ($series) {
58-
$_POST = ['zero' => 0];
58+
$_POST = ['zero' => '0'];
5959

6060
$form = new Form;
6161
$input = $form->addRadioList('zero', null, $series);
@@ -106,7 +106,7 @@ test('disabled key', function () use ($series) {
106106

107107

108108
test('malformed data', function () use ($series) {
109-
$_POST = ['malformed' => [null]];
109+
$_POST = ['malformed' => ['']];
110110

111111
$form = new Form;
112112
$input = $form->addRadioList('malformed', null, $series);

tests/Forms/Controls.SelectBox.loadData.phpt

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -125,7 +125,7 @@ test('Select with prompt and invalid input', function () use ($series) {
125125

126126

127127
test('Indexed arrays', function () use ($series) {
128-
$_POST = ['zero' => 0];
128+
$_POST = ['zero' => '0'];
129129

130130
$form = new Form;
131131
$input = $form->addSelect('zero', null, $series);
@@ -175,7 +175,7 @@ test('disabled key', function () use ($series) {
175175

176176

177177
test('malformed data', function () use ($series) {
178-
$_POST = ['malformed' => [null]];
178+
$_POST = ['malformed' => ['']];
179179

180180
$form = new Form;
181181
$input = $form->addSelect('malformed', null, $series);
@@ -280,7 +280,7 @@ test('disabled one', function () use ($series) {
280280
});
281281

282282
test('', function () {
283-
$_POST = ['select' => 1];
283+
$_POST = ['select' => '1'];
284284

285285
$form = new Form;
286286
$input = $form->addSelect('select', null, [

tests/Forms/Controls.TextBase.loadData.phpt

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -81,7 +81,7 @@ test('missing data', function () {
8181

8282

8383
test('malformed data', function () {
84-
$_POST = ['malformed' => [null]];
84+
$_POST = ['malformed' => ['']];
8585

8686
$form = new Form;
8787
$input = $form->addText('malformed');

0 commit comments

Comments
 (0)