44
55use Illuminate \Support \Facades \Artisan ;
66use InvalidArgumentException ;
7+ use PHPUnit \Framework \Attributes \DataProvider ;
8+ use PHPUnit \Framework \Attributes \Test ;
79use Tests \TestCase ;
810
9- class CurlCommandTest extends TestCase
11+ final class CurlCommandTest extends TestCase
1012{
11- /**
12- * @test
13- * @dataProvider curlCommandFixtures
14- */
15- public function it_converts_curl_requests_to_http_client_code ($ fixture )
13+ #[Test]
14+ #[DataProvider('curlCommandFixtures ' )]
15+ public function it_converts_curl_requests_to_http_client_code ($ fixture ): void
1616 {
1717 $ code = Artisan::call ('shift: ' . $ this ->fixture ($ fixture . '.in ' ));
1818 $ output = trim (Artisan::output ());
@@ -21,23 +21,23 @@ public function it_converts_curl_requests_to_http_client_code($fixture)
2121 $ this ->assertSame ($ this ->fixture ($ fixture . '.out ' ), $ output );
2222 }
2323
24- public function test_it_throw_exception_when_for_invalid_url ()
24+ public function test_it_throw_exception_when_for_invalid_url (): void
2525 {
2626 $ this ->expectException (InvalidArgumentException::class);
2727 $ this ->expectExceptionMessage ('The "https://{domain:port}/api/{id}/" URL is invalid. ' );
2828
2929 Artisan::call ('shift:curl -X GET "https://{domain:port}/api/{id}/" ' );
3030 }
3131
32- public function test_it_throw_exception_when_for_invalid_headers ()
32+ public function test_it_throw_exception_when_for_invalid_headers (): void
3333 {
3434 $ this ->expectException (InvalidArgumentException::class);
3535 $ this ->expectExceptionMessage ('The "foo" header must be a key/value pair separated by ":". ' );
3636
3737 Artisan::call ("shift:curl https://example.com --header 'foo' " );
3838 }
3939
40- public function curlCommandFixtures ()
40+ public static function curlCommandFixtures (): array
4141 {
4242 return [
4343 'GET request ' => ['basic-get ' ],
@@ -61,6 +61,7 @@ public function curlCommandFixtures()
6161 'Missing URL scheme ' => ['missing-url-scheme ' ],
6262 'GET request with compressed flag ' => ['with-compressed-option ' ],
6363 'GET request with insecure flag ' => ['with-insecure-option ' ],
64+ 'GET request with short k flag ' => ['with-insecure-k-option ' ],
6465 'Request with raw data ' => ['with-raw-data ' ],
6566 'POST request with mixed data ' => ['raw-data-mixed ' ],
6667 'Request with cert (path only) ' => ['with-cert-path-only ' ],
0 commit comments