Repository: symfony/symfony
File: src/Symfony/Component/HttpClient/Tests/DataCollector/HttpClientDataCollectorTest.php (PHP)

Code before:
                    'base_uri' => 'http://localhost:8057/json/',
                ],
            ],
            'curl \\
  --compressed \\
  --request GET \\
  --url %1$shttp://localhost:8057/json/1%1$s \\
  --header %1$sAccept: */*%1$s \\
  --header %1$sAccept-Encoding: gzip%1$s \\
  --header %1$sUser-Agent: Symfony HttpClient (Native)%1$s',
        ];
        yield 'GET with resolve' => [
            [
                'method' => 'GET',
                'url' => 'http://localhost:8057/json',
                'options' => [
                    'resolve' => [
                        'localhost' => '127.0.0.1',
                        'example.com' => null,
                    ],
                ],
            ],
            'curl \\
  --compressed \\
  --resolve %1$slocalhost:8057:127.0.0.1%1$s \\
  --request GET \\
  --url %1$shttp://localhost:8057/json%1$s \\
  --header %1$sAccept: */*%1$s \\
  --header %1$sAccept-Encoding: gzip%1$s \\
  --header %1$sUser-Agent: Symfony HttpClient (Native)%1$s',
        ];
        yield 'POST with string body' => [
            [
                'method' => 'POST',
                'url' => 'http://localhost:8057/json',
                'options' => [
                    'body' => 'foo bar baz',
                ],
            ],
            'curl \\
  --compressed \\
  --request POST \\
  --url %1$shttp://localhost:8057/json%1$s \\
  --header %1$sAccept: */*%1$s \\
  --header %1$sContent-Length: 11%1$s \\
  --header %1$sContent-Type: application/x-www-form-urlencoded%1$s \\
  --header %1$sAccept-Encoding: gzip%1$s \\
  --header %1$sUser-Agent: Symfony HttpClient (Native)%1$s \\
  --data-raw %1$sfoo bar baz%1$s',
        ];
        yield 'POST with array body' => [

Review comment (bug):
The way those assertions are written now means that removing the argument escaping in the implementation would not make test fail. Is it really what we want for cleaner tests ?

Code after:
                ],
            ],
            'curl \\
  --compressed \\
  --request GET \\
  --url http://localhost:8057/json/1 \\
  --header Accept: */* \\
  --header Accept-Encoding: gzip \\
  --header User-Agent: Symfony HttpClient (Native)',
        ];
        yield 'GET with resolve' => [
            [
                'method' => 'GET',
                'url' => 'http://localhost:8057/json',
                'options' => [
                    'resolve' => [
                        'localhost' => '127.0.0.1',
                        'example.com' => null,
                    ],
                ],
            ],
            'curl \\
  --compressed \\
  --resolve localhost:8057:127.0.0.1 \\
  --request GET \\
  --url http://localhost:8057/json \\
  --header Accept: */* \\
  --header Accept-Encoding: gzip \\
  --header User-Agent: Symfony HttpClient (Native)',
        ];
        yield 'POST with string body' => [
            [
                'method' => 'POST',
                'url' => 'http://localhost:8057/json',
                'options' => [
                    'body' => 'foo bar baz',
                ],
            ],
            'curl \\
  --compressed \\
  --request POST \\
  --url http://localhost:8057/json \\
  --header Accept: */* \\
  --header Content-Length: 11 \\
  --header Content-Type: application/x-www-form-urlencoded \\
  --header Accept-Encoding: gzip \\
  --header User-Agent: Symfony HttpClient (Native) \\
  --data-raw foo bar baz',
        ];
        yield 'POST with array body' => [
            [