Skip to content

Commit bc990ed

Browse files
committed
tests: improved descriptions
1 parent 7457b5c commit bc990ed

File tree

60 files changed

+467
-465
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

60 files changed

+467
-465
lines changed

tests/Forms/Container.values.ArrayHash.phpt

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -40,7 +40,7 @@ function createForm(): Form
4040
}
4141

4242

43-
test('setDefaults() + iterable', function () {
43+
test('setting defaults using ArrayHash', function () {
4444
$form = createForm();
4545
Assert::false($form->isSubmitted());
4646

@@ -69,7 +69,7 @@ test('setDefaults() + iterable', function () {
6969
});
7070

7171

72-
test('submitted form + getValues()', function () {
72+
test('retrieving POST data as ArrayHash', function () {
7373
$_SERVER['REQUEST_METHOD'] = 'POST';
7474

7575
$form = createForm();
@@ -87,7 +87,7 @@ test('submitted form + getValues()', function () {
8787
});
8888

8989

90-
test('submitted form + reset()', function () {
90+
test('resetting form with ArrayHash values', function () {
9191
$_SERVER['REQUEST_METHOD'] = 'POST';
9292

9393
$form = createForm();
@@ -109,7 +109,7 @@ test('submitted form + reset()', function () {
109109
});
110110

111111

112-
test('setValues() + iterable', function () {
112+
test('updating values with ArrayHash and erase', function () {
113113
$_SERVER['REQUEST_METHOD'] = 'POST';
114114

115115
$form = createForm();
@@ -154,7 +154,7 @@ test('setValues() + iterable', function () {
154154
});
155155

156156

157-
test('onSuccess test', function () {
157+
test('onSuccess event with ArrayHash values', function () {
158158
$_SERVER['REQUEST_METHOD'] = 'POST';
159159

160160
$form = createForm();

tests/Forms/Container.values.array.phpt

Lines changed: 10 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -40,7 +40,7 @@ function createForm(): Form
4040
}
4141

4242

43-
test('setDefaults() + array', function () {
43+
test('setting form defaults and retrieving array values', function () {
4444
$form = createForm();
4545
Assert::false($form->isSubmitted());
4646

@@ -69,7 +69,7 @@ test('setDefaults() + array', function () {
6969
});
7070

7171

72-
test('submitted form + getValues(array)', function () {
72+
test('handles POST submission with nested data', function () {
7373
$_SERVER['REQUEST_METHOD'] = 'POST';
7474

7575
$form = createForm();
@@ -87,7 +87,7 @@ test('submitted form + getValues(array)', function () {
8787
});
8888

8989

90-
test('submitted form + reset()', function () {
90+
test('resetting form clears submitted values', function () {
9191
$_SERVER['REQUEST_METHOD'] = 'POST';
9292

9393
$form = createForm();
@@ -109,7 +109,7 @@ test('submitted form + reset()', function () {
109109
});
110110

111111

112-
test('setValues() + array', function () {
112+
test('setting form values with erase option', function () {
113113
$_SERVER['REQUEST_METHOD'] = 'POST';
114114

115115
$form = createForm();
@@ -154,7 +154,7 @@ test('setValues() + array', function () {
154154
});
155155

156156

157-
test('getValues(...arguments...)', function () {
157+
test('updating form values without erasing', function () {
158158
$_SERVER['REQUEST_METHOD'] = 'POST';
159159

160160
$form = createForm();
@@ -181,7 +181,7 @@ test('getValues(...arguments...)', function () {
181181
});
182182

183183

184-
test('setMappedType(array)', function () {
184+
test('using array as mapped type for form values', function () {
185185
$_SERVER['REQUEST_METHOD'] = 'POST';
186186

187187
$form = createForm();
@@ -209,7 +209,7 @@ test('setMappedType(array)', function () {
209209
});
210210

211211

212-
test('onSuccess test', function () {
212+
test('triggering onSuccess with correct value types', function () {
213213
$_SERVER['REQUEST_METHOD'] = 'POST';
214214

215215
$form = createForm();
@@ -262,7 +262,7 @@ test('onSuccess test', function () {
262262
});
263263

264264

265-
test('submitted form + setValidationScope() + getValues(array)', function () {
265+
test('validation scope limits submitted data', function () {
266266
$_SERVER['REQUEST_METHOD'] = 'POST';
267267
$_POST['send'] = '';
268268

@@ -280,7 +280,7 @@ test('submitted form + setValidationScope() + getValues(array)', function () {
280280
});
281281

282282

283-
test('submitted form + setValidationScope() + getValues(array)', function () {
283+
test('validation scope applied to container', function () {
284284
$_SERVER['REQUEST_METHOD'] = 'POST';
285285
$_POST['send'] = '';
286286

@@ -297,7 +297,7 @@ test('submitted form + setValidationScope() + getValues(array)', function () {
297297
], $form['first']->getValues('array'));
298298
});
299299

300-
test('submitted form + setValidationScope() + getValues(array)', function () {
300+
test('validation scope on nested container fields', function () {
301301
$_SERVER['REQUEST_METHOD'] = 'POST';
302302
$_POST['send'] = '';
303303

tests/Forms/Container.values.mapping-constructor.phpt

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -55,7 +55,7 @@ function createForm(): Form
5555
}
5656

5757

58-
test('getValues(...arguments...)', function () {
58+
test('mapping form values to constructor-injected objects', function () {
5959
$form = createForm();
6060

6161
$form->setValues([

tests/Forms/Container.values.mapping-enum.phpt

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -25,7 +25,7 @@ class FormWithEnum
2525
}
2626

2727

28-
test('getValues() + enum', function () {
28+
test('handling enum types in form data', function () {
2929
$form = new Form;
3030
$form->addText('enum1');
3131
$form->addText('enum2')->setNullable();

tests/Forms/Container.values.mapping.phpt

Lines changed: 9 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -66,7 +66,7 @@ function createForm(): Form
6666
}
6767

6868

69-
test('setDefaults() + object', function () {
69+
test('setting defaults using object mapping', function () {
7070
$_SERVER['REQUEST_METHOD'] = null;
7171

7272
$form = createForm();
@@ -97,7 +97,7 @@ test('setDefaults() + object', function () {
9797
});
9898

9999

100-
test('submitted form + getValues()', function () {
100+
test('mapping POST data to objects', function () {
101101
$form = createForm();
102102
$form->setMappedType(FormData::class);
103103

@@ -115,7 +115,7 @@ test('submitted form + getValues()', function () {
115115
});
116116

117117

118-
test('submitted form + reset()', function () {
118+
test('resetting form with object-mapped values', function () {
119119
$form = createForm();
120120
$form->setMappedType(FormData::class);
121121

@@ -137,7 +137,7 @@ test('submitted form + reset()', function () {
137137
});
138138

139139

140-
test('setValues() + object', function () {
140+
test('updating object-mapped values with erase', function () {
141141
$form = createForm();
142142
$form->setMappedType(FormData::class);
143143

@@ -183,7 +183,7 @@ test('setValues() + object', function () {
183183
});
184184

185185

186-
test('getValues(...arguments...)', function () {
186+
test('mixed object and array value mapping', function () {
187187
$_SERVER['REQUEST_METHOD'] = null;
188188

189189
$form = createForm();
@@ -234,7 +234,7 @@ test('getValues(...arguments...)', function () {
234234
});
235235

236236

237-
test('onSuccess test', function () {
237+
test('onSuccess with multiple mapped value types', function () {
238238
$form = createForm();
239239
$form->setMappedType(FormData::class);
240240

@@ -300,7 +300,7 @@ test('onSuccess test', function () {
300300
});
301301

302302

303-
test('getValues() + object', function () {
303+
test('populating existing object with form values', function () {
304304
$form = createForm();
305305
$obj = $orig = new FormData;
306306

@@ -319,7 +319,7 @@ test('getValues() + object', function () {
319319
});
320320

321321

322-
test('submitted form + setValidationScope() + getValues()', function () {
322+
test('validation scope on object-mapped fields', function () {
323323
$_POST['send'] = '';
324324

325325
$form = createForm();
@@ -336,7 +336,7 @@ test('submitted form + setValidationScope() + getValues()', function () {
336336
});
337337

338338

339-
test('submitted form + setValidationScope() + getValues()', function () {
339+
test('validation scope on nested object fields', function () {
340340
$_POST['send'] = '';
341341

342342
$form = createForm();

tests/Forms/Controls.BaseControl.phpt

Lines changed: 9 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,7 @@ setUp(function () {
2020
});
2121

2222

23-
test('error handling', function () {
23+
test('error handling for required text input', function () {
2424
$form = new Form;
2525
$input = $form->addText('text')
2626
->setRequired('error');
@@ -40,7 +40,7 @@ test('error handling', function () {
4040
});
4141

4242

43-
test('validators', function () {
43+
test('validation methods for text input values', function () {
4444
$form = new Form;
4545
$input = $form->addText('text');
4646
$input->setValue(123);
@@ -77,7 +77,7 @@ test('validators', function () {
7777
});
7878

7979

80-
test('validators for array', function () {
80+
test('multiSelect validation and length checks', function () {
8181
$form = new Form;
8282
$input = $form->addMultiSelect('select', null, ['a', 'b', 'c', 'd']);
8383
$input->setValue([1, 2, 3]);
@@ -100,23 +100,23 @@ test('validators for array', function () {
100100
});
101101

102102

103-
test('setHtmlId', function () {
103+
test('custom HTML ID for text input', function () {
104104
$form = new Form;
105105
$input = $form->addText('text')->setHtmlId('myId');
106106

107107
Assert::same('<input type="text" name="text" id="myId">', (string) $input->getControl());
108108
});
109109

110110

111-
test('special name', function () {
111+
test('input name conflict resolution', function () {
112112
$form = new Form;
113113
$input = $form->addText('submit');
114114

115115
Assert::same('<input type="text" name="_submit" id="frm-submit">', (string) $input->getControl());
116116
});
117117

118118

119-
test('disabled', function () {
119+
test('disabled input retains default value', function () {
120120
$form = new Form;
121121
$form->addText('disabled')
122122
->setDisabled()
@@ -128,7 +128,7 @@ test('disabled', function () {
128128
});
129129

130130

131-
test('disabled & submitted', function () {
131+
test('disabled inputs ignore POST data', function () {
132132
$_SERVER['REQUEST_METHOD'] = 'POST';
133133
$_POST = ['disabled' => 'submitted value'];
134134
$_COOKIE[Nette\Http\Helpers::StrictCookieName] = '1';
@@ -156,7 +156,7 @@ test('disabled & submitted', function () {
156156
});
157157

158158

159-
test('', function () {
159+
test('translator integration for labels and errors', function () {
160160
$form = new Form;
161161
$form->setTranslator(new class implements Nette\Localization\ITranslator {
162162
public function translate($s, ...$parameters): string
@@ -190,7 +190,7 @@ test('', function () {
190190
});
191191

192192

193-
test('change HTML name', function () {
193+
test('dynamic HTML name attribute handling', function () {
194194
$_POST = ['b' => '123', 'send' => ''];
195195
$form = new Form;
196196
$form->addSubmit('send', 'Send');

tests/Forms/Controls.Button.loadData.phpt

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,7 @@ setUp(function () {
2222
});
2323

2424

25-
test('', function () {
25+
test('submit button captures POST value', function () {
2626
$_POST = [
2727
'button' => 'x',
2828
];
@@ -34,7 +34,7 @@ test('', function () {
3434
});
3535

3636

37-
test('empty value', function () {
37+
test('submit button with empty and zero values', function () {
3838
$_POST = [
3939
'button1' => '',
4040
'button2' => '0',
@@ -52,15 +52,15 @@ test('empty value', function () {
5252
});
5353

5454

55-
test('missing data', function () {
55+
test('unsubmitted button state', function () {
5656
$form = new Form;
5757
$input = $form->addSubmit('button');
5858
Assert::false($input->isFilled());
5959
Assert::null($input->getValue());
6060
});
6161

6262

63-
test('malformed data', function () {
63+
test('handling malformed POST data for button', function () {
6464
$_POST = [
6565
'malformed' => [],
6666
];

0 commit comments

Comments
 (0)