Skip to content

Commit 62fda45

Browse files
Merge branch '10.0' into 10.1
2 parents 6b6f13a + 5fca69b commit 62fda45

File tree

5 files changed

+115
-0
lines changed

5 files changed

+115
-0
lines changed

.styleci.yml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,7 @@ enabled:
77
- alpha_ordered_imports
88
- array_indentation
99
- const_visibility_required
10+
- declare_strict_types
1011
- native_constant_invocation
1112
- native_function_invocation
1213
- phpdoc_order

CHANGELOG.md

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,13 @@ CHANGE LOG
77
* Added method to get protected branches for a project
88

99

10+
## 10.0.1 (24/10/2020)
11+
12+
* Fixed using the name of a group as an ID
13+
* Fixed various phpdoc issues
14+
* Reverted query builder changes
15+
16+
1017
## 10.0.0 (15/08/2020)
1118

1219
* Added void return types to void methods

tests/ClientTest.php

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,7 @@
11
<?php
22

3+
declare(strict_types=1);
4+
35
namespace Gitlab\Tests;
46

57
use Gitlab\Client;
Lines changed: 103 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,103 @@
1+
<?php
2+
3+
declare(strict_types=1);
4+
5+
namespace Gitlab\Tests\HttpClient\Util;
6+
7+
use Gitlab\HttpClient\Util\QueryStringBuilder;
8+
use PHPUnit\Framework\TestCase;
9+
10+
class QueryStringBuilderTest extends TestCase
11+
{
12+
/**
13+
* @dataProvider queryStringProvider
14+
*
15+
* @param mixed $query
16+
* @param string $expected
17+
*/
18+
public function testBuild($query, string $expected): void
19+
{
20+
$this->assertSame($expected, QueryStringBuilder::build($query));
21+
}
22+
23+
public function queryStringProvider()
24+
{
25+
//Scalar value.
26+
yield [
27+
'a project',
28+
'a%20project',
29+
];
30+
31+
//Indexed array.
32+
yield [
33+
['iids' => [88, 86]],
34+
//iids[]=88&iids[]=86
35+
'iids%5B%5D=88&iids%5B%5D=86',
36+
];
37+
38+
//Non indexed array with only numeric keys.
39+
yield [
40+
['iids' => [0 => 88, 2 => 86]],
41+
//iids[0]=88&iids[2]=86
42+
'iids%5B0%5D=88&iids%5B2%5D=86',
43+
];
44+
45+
yield [
46+
[
47+
'source_branch' => 'test_source',
48+
'target_branch' => 'test_master',
49+
'title' => 'test',
50+
],
51+
'source_branch=test_source&target_branch=test_master&title=test',
52+
];
53+
54+
//Boolean encoding
55+
yield [
56+
['push_events' => false, 'merge_requests_events' => 1],
57+
'push_events=0&merge_requests_events=1',
58+
];
59+
60+
//A deeply nested array.
61+
yield [
62+
[
63+
'search' => 'a project',
64+
'owned' => 'true',
65+
'iids' => [88, 86],
66+
'assoc' => [
67+
'a' => 'b',
68+
'c' => [
69+
'd' => 'e',
70+
'f' => 'g',
71+
],
72+
],
73+
'nested' => [
74+
'a' => [
75+
[
76+
'b' => 'c',
77+
],
78+
[
79+
'd' => 'e',
80+
'f' => [
81+
'g' => 'h',
82+
'i' => 'j',
83+
'k' => [87, 89],
84+
],
85+
],
86+
],
87+
],
88+
],
89+
//search=a project
90+
//&owned=true
91+
//&iids[]=88&iids[]=86
92+
//&assoc[a]=b&assoc[c][d]=e&assoc[c][f]=g
93+
//&nested[a][][b]=c&nested[a][][d]=e
94+
//&nested[a][][f][g]=h&nested[a][][f][i]=j
95+
//&nested[a][][f][k][]=87&nested[a][][f][k][]=89
96+
'search=a%20project&owned=true&iids%5B%5D=88&iids%5B%5D=86'.
97+
'&assoc%5Ba%5D=b&assoc%5Bc%5D%5Bd%5D=e&assoc%5Bc%5D%5Bf%5D=g'.
98+
'&nested%5Ba%5D%5B%5D%5Bb%5D=c&nested%5Ba%5D%5B%5D%5Bd%5D=e'.
99+
'&nested%5Ba%5D%5B%5D%5Bf%5D%5Bg%5D=h&nested%5Ba%5D%5B%5D%5Bf%5D%5Bi%5D=j'.
100+
'&nested%5Ba%5D%5B%5D%5Bf%5D%5Bk%5D%5B%5D=87&nested%5Ba%5D%5B%5D%5Bf%5D%5Bk%5D%5B%5D=89',
101+
];
102+
}
103+
}

tests/IntegrationTest.php

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,7 @@
11
<?php
22

3+
declare(strict_types=1);
4+
35
namespace Gitlab\Tests;
46

57
use Gitlab\Client;

0 commit comments

Comments
 (0)