Skip to content

Commit dc8fe5a

Browse files
committed
Fix bug in NativeCurlClient
1 parent e141467 commit dc8fe5a

File tree

2 files changed

+13
-11
lines changed

2 files changed

+13
-11
lines changed

src/Redmine/Client/NativeCurlClient.php

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -102,31 +102,31 @@ public function stopImpersonateUser(): void
102102
*/
103103
public function requestGet(string $path): bool
104104
{
105-
return $this->runRequest('get', $path);
105+
return $this->runRequest('GET', $path);
106106
}
107107

108108
/**
109109
* Create and send a POST request.
110110
*/
111111
public function requestPost(string $path, string $body): bool
112112
{
113-
return $this->runRequest('post', $path, $body);
113+
return $this->runRequest('POST', $path, $body);
114114
}
115115

116116
/**
117117
* Create and send a PUT request.
118118
*/
119119
public function requestPut(string $path, string $body): bool
120120
{
121-
return $this->runRequest('put', $path, $body);
121+
return $this->runRequest('PUT', $path, $body);
122122
}
123123

124124
/**
125125
* Create and send a DELETE request.
126126
*/
127127
public function requestDelete(string $path): bool
128128
{
129-
return $this->runRequest('delete', $path);
129+
return $this->runRequest('DELETE', $path);
130130
}
131131

132132
/**
@@ -295,7 +295,7 @@ private function createCurl(string $method, string $path, string $body = '', str
295295
unset($curlOptions[CURLOPT_POST]);
296296
unset($curlOptions[CURLOPT_POSTFIELDS]);
297297
switch ($method) {
298-
case 'post':
298+
case 'POST':
299299
$curlOptions[CURLOPT_POST] = 1;
300300
if ($this->isUploadCall($path) && $this->isValidFilePath($body)) {
301301
@trigger_error('Uploading an attachment by filepath is deprecated, use file_get_contents() to upload the file content instead.', E_USER_DEPRECATED);
@@ -311,13 +311,13 @@ private function createCurl(string $method, string $path, string $body = '', str
311311
$curlOptions[CURLOPT_POSTFIELDS] = $body;
312312
}
313313
break;
314-
case 'put':
314+
case 'PUT':
315315
$curlOptions[CURLOPT_CUSTOMREQUEST] = 'PUT';
316316
if ($body !== '') {
317317
$curlOptions[CURLOPT_POSTFIELDS] = $body;
318318
}
319319
break;
320-
case 'delete':
320+
case 'DELETE':
321321
$curlOptions[CURLOPT_CUSTOMREQUEST] = 'DELETE';
322322
break;
323323
default: // GET

tests/End2End/Group/GroupTest.php

Lines changed: 6 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -29,11 +29,13 @@ public function testInteractionWithGroup(RedmineVersion $redmineVersion): void
2929
'name' => $groupName,
3030
]);
3131

32-
$groupData = json_decode(json_encode($xmlData), true);
32+
$jsonData = json_encode($xmlData);
3333

34-
$this->assertIsArray($groupData, json_encode($groupData));
35-
$this->assertIsString($groupData['id']);
36-
$this->assertSame($groupName, $groupData['name']);
34+
$groupData = json_decode($jsonData, true);
35+
36+
$this->assertIsArray($groupData, $jsonData);
37+
$this->assertIsString($groupData['id'], $jsonData);
38+
$this->assertSame($groupName, $groupData['name'], $jsonData);
3739

3840
$groupId = (int) $groupData['id'];
3941

0 commit comments

Comments
 (0)