Skip to content

Commit d6d54e3

Browse files
Improve test data provider (#690)
1 parent 999b98f commit d6d54e3

File tree

1 file changed

+15
-21
lines changed

1 file changed

+15
-21
lines changed

tests/HttpClient/Util/QueryStringBuilderTest.php

Lines changed: 15 additions & 21 deletions
Original file line numberDiff line numberDiff line change
@@ -32,21 +32,21 @@ public function testBuild(array $query, string $expected): void
3232

3333
public function queryStringProvider()
3434
{
35-
//Indexed array.
36-
yield [
37-
['iids' => [88, 86]],
38-
//iids[]=88&iids[]=86
35+
yield 'indexed array' => [
36+
[
37+
'iids' => [88, 86],
38+
],
3939
'iids%5B%5D=88&iids%5B%5D=86',
4040
];
4141

42-
//Non indexed array with only numeric keys.
43-
yield [
44-
['iids' => [0 => 88, 2 => 86]],
45-
//iids[0]=88&iids[2]=86
42+
yield 'non-indexed array with only numeric keys' => [
43+
[
44+
'iids' => [0 => 88, 2 => 86],
45+
],
4646
'iids%5B0%5D=88&iids%5B2%5D=86',
4747
];
4848

49-
yield [
49+
yield 'indexed array with multiple entries' => [
5050
[
5151
'source_branch' => 'test_source',
5252
'target_branch' => 'test_master',
@@ -55,14 +55,15 @@ public function queryStringProvider()
5555
'source_branch=test_source&target_branch=test_master&title=test',
5656
];
5757

58-
//Boolean encoding
59-
yield [
60-
['push_events' => false, 'merge_requests_events' => 1],
58+
yield 'boolean encoding with multiple entries' => [
59+
[
60+
'push_events' => false,
61+
'merge_requests_events' => 1,
62+
],
6163
'push_events=0&merge_requests_events=1',
6264
];
6365

64-
//A deeply nested array.
65-
yield [
66+
yield 'deeply nested array' => [
6667
[
6768
'search' => 'a project',
6869
'owned' => 'true',
@@ -90,13 +91,6 @@ public function queryStringProvider()
9091
],
9192
],
9293
],
93-
//search=a project
94-
//&owned=true
95-
//&iids[]=88&iids[]=86
96-
//&assoc[a]=b&assoc[c][d]=e&assoc[c][f]=g
97-
//&nested[a][][b]=c&nested[a][][d]=e
98-
//&nested[a][][f][g]=h&nested[a][][f][i]=j
99-
//&nested[a][][f][k][]=87&nested[a][][f][k][]=89
10094
'search=a%20project&owned=true&iids%5B%5D=88&iids%5B%5D=86'.
10195
'&assoc%5Ba%5D=b&assoc%5Bc%5D%5Bd%5D=e&assoc%5Bc%5D%5Bf%5D=g'.
10296
'&nested%5Ba%5D%5B%5D%5Bb%5D=c&nested%5Ba%5D%5B%5D%5Bd%5D=e'.

0 commit comments

Comments
 (0)