Skip to content

Commit dcc465f

Browse files
[HttpKernel] Fix quotes expectations in tests
1 parent b8bba36 commit dcc465f

File tree

1 file changed

+7
-5
lines changed

1 file changed

+7
-5
lines changed

src/Symfony/Component/HttpClient/Tests/DataCollector/HttpClientDataCollectorTest.php

+7-5
Original file line numberDiff line numberDiff line change
@@ -175,7 +175,9 @@ public function testItGeneratesCurlCommandsAsExpected(array $request, string $ex
175175
$collectedData = $sut->getClients();
176176
self::assertCount(1, $collectedData['http_client']['traces']);
177177
$curlCommand = $collectedData['http_client']['traces'][0]['curlCommand'];
178-
self::assertEquals(sprintf($expectedCurlCommand, '\\' === \DIRECTORY_SEPARATOR ? '"' : "'"), $curlCommand);
178+
179+
$isWindows = '\\' === \DIRECTORY_SEPARATOR;
180+
self::assertEquals(sprintf($expectedCurlCommand, $isWindows ? '"' : "'", $isWindows ? '' : "'"), $curlCommand);
179181
}
180182

181183
public static function provideCurlRequests(): iterable
@@ -234,19 +236,19 @@ public static function provideCurlRequests(): iterable
234236
'method' => 'POST',
235237
'url' => 'http://localhost:8057/json',
236238
'options' => [
237-
'body' => 'foobarbaz',
239+
'body' => 'foo bar baz',
238240
],
239241
],
240242
'curl \\
241243
--compressed \\
242244
--request POST \\
243245
--url %1$shttp://localhost:8057/json%1$s \\
244246
--header %1$sAccept: */*%1$s \\
245-
--header %1$sContent-Length: 9%1$s \\
247+
--header %1$sContent-Length: 11%1$s \\
246248
--header %1$sContent-Type: application/x-www-form-urlencoded%1$s \\
247249
--header %1$sAccept-Encoding: gzip%1$s \\
248250
--header %1$sUser-Agent: Symfony HttpClient (Native)%1$s \\
249-
--data-raw %1$sfoobarbaz%1$s',
251+
--data-raw %1$sfoo bar baz%1$s',
250252
];
251253
yield 'POST with array body' => [
252254
[
@@ -284,7 +286,7 @@ public function __toString(): string
284286
--header %1$sContent-Length: 211%1$s \\
285287
--header %1$sAccept-Encoding: gzip%1$s \\
286288
--header %1$sUser-Agent: Symfony HttpClient (Native)%1$s \\
287-
--data-raw %1$sfoo=fooval%1$s --data-raw %1$sbar=barval%1$s --data-raw %1$sbaz=bazval%1$s --data-raw %1$sfoobar[baz]=bazval%1$s --data-raw %1$sfoobar[qux]=quxval%1$s --data-raw %1$sbazqux[0]=bazquxval1%1$s --data-raw %1$sbazqux[1]=bazquxval2%1$s --data-raw %1$sobject[fooprop]=foopropval%1$s --data-raw %1$sobject[barprop]=barpropval%1$s --data-raw %1$stostring=tostringval%1$s',
289+
--data-raw %2$sfoo=fooval%2$s --data-raw %2$sbar=barval%2$s --data-raw %2$sbaz=bazval%2$s --data-raw %2$sfoobar[baz]=bazval%2$s --data-raw %2$sfoobar[qux]=quxval%2$s --data-raw %2$sbazqux[0]=bazquxval1%2$s --data-raw %2$sbazqux[1]=bazquxval2%2$s --data-raw %2$sobject[fooprop]=foopropval%2$s --data-raw %2$sobject[barprop]=barpropval%2$s --data-raw %2$stostring=tostringval%2$s',
288290
];
289291

290292
// escapeshellarg on Windows replaces double quotes & percent signs with spaces

0 commit comments

Comments
 (0)