From 16d4c3fafb110773218d6788d22d984e21f16d05 Mon Sep 17 00:00:00 2001 From: Jason McCreary Date: Sat, 23 Aug 2025 14:27:02 -0400 Subject: [PATCH 1/8] Latest supported Laravel versions --- composer.json | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/composer.json b/composer.json index bb47c03..acb0696 100644 --- a/composer.json +++ b/composer.json @@ -5,13 +5,13 @@ "keywords": ["curl", "converter", "http", "laravel", "shift"], "license": "MIT", "require": { - "php": "^8.0", - "illuminate/console": "^9.0|^10.0", - "illuminate/support": "^9.0|^10.0", - "symfony/var-exporter": "^6.3" + "php": "^8.3", + "illuminate/console": "^11.0|^12.0", + "illuminate/support": "^11.0|^12.0", + "symfony/var-exporter": "^7.0" }, "require-dev": { - "laravel/pint": "^1.1", + "laravel/pint": "^1.24", "mockery/mockery": "^1.4.4", "orchestra/testbench": "^7.0", "phpunit/phpunit": "^9.5.10" From 5d5b186f9efcd1fe1f075dd9a7f1ebb2942c62ed Mon Sep 17 00:00:00 2001 From: Jason McCreary Date: Sat, 23 Aug 2025 14:28:16 -0400 Subject: [PATCH 2/8] PHPUnit 10 Shift (#37) --- .gitignore | 2 +- composer.json | 10 ++++++++-- .../Console/Commands/CurlCommandTest.php | 18 +++++++++--------- 3 files changed, 18 insertions(+), 12 deletions(-) diff --git a/.gitignore b/.gitignore index 4f72470..1e79b6d 100644 --- a/.gitignore +++ b/.gitignore @@ -6,7 +6,7 @@ /vendor .env .env.backup -.phpunit.result.cache +/.phpunit.cache Homestead.json Homestead.yaml auth.json diff --git a/composer.json b/composer.json index acb0696..8ea0f5a 100644 --- a/composer.json +++ b/composer.json @@ -2,7 +2,13 @@ "name": "laravel-shift/curl-converter", "description": "A command line tool to convert curl requests to Laravel HTTP requests.", "type": "library", - "keywords": ["curl", "converter", "http", "laravel", "shift"], + "keywords": [ + "curl", + "converter", + "http", + "laravel", + "shift" + ], "license": "MIT", "require": { "php": "^8.3", @@ -14,7 +20,7 @@ "laravel/pint": "^1.24", "mockery/mockery": "^1.4.4", "orchestra/testbench": "^7.0", - "phpunit/phpunit": "^9.5.10" + "phpunit/phpunit": "^10.0" }, "autoload": { "psr-4": { diff --git a/tests/Feature/Console/Commands/CurlCommandTest.php b/tests/Feature/Console/Commands/CurlCommandTest.php index 83c74d3..c85f925 100644 --- a/tests/Feature/Console/Commands/CurlCommandTest.php +++ b/tests/Feature/Console/Commands/CurlCommandTest.php @@ -2,17 +2,17 @@ namespace Tests\Feature\Console\Commands; +use PHPUnit\Framework\Attributes\DataProvider; +use PHPUnit\Framework\Attributes\Test; use Illuminate\Support\Facades\Artisan; use InvalidArgumentException; use Tests\TestCase; -class CurlCommandTest extends TestCase +final class CurlCommandTest extends TestCase { - /** - * @test - * @dataProvider curlCommandFixtures - */ - public function it_converts_curl_requests_to_http_client_code($fixture) + #[Test] + #[DataProvider('curlCommandFixtures')] + public function it_converts_curl_requests_to_http_client_code($fixture): void { $code = Artisan::call('shift:' . $this->fixture($fixture . '.in')); $output = trim(Artisan::output()); @@ -21,7 +21,7 @@ public function it_converts_curl_requests_to_http_client_code($fixture) $this->assertSame($this->fixture($fixture . '.out'), $output); } - public function test_it_throw_exception_when_for_invalid_url() + public function test_it_throw_exception_when_for_invalid_url(): void { $this->expectException(InvalidArgumentException::class); $this->expectExceptionMessage('The "https://{domain:port}/api/{id}/" URL is invalid.'); @@ -29,7 +29,7 @@ public function test_it_throw_exception_when_for_invalid_url() Artisan::call('shift:curl -X GET "https://{domain:port}/api/{id}/"'); } - public function test_it_throw_exception_when_for_invalid_headers() + public function test_it_throw_exception_when_for_invalid_headers(): void { $this->expectException(InvalidArgumentException::class); $this->expectExceptionMessage('The "foo" header must be a key/value pair separated by ":".'); @@ -37,7 +37,7 @@ public function test_it_throw_exception_when_for_invalid_headers() Artisan::call("shift:curl https://example.com --header 'foo'"); } - public function curlCommandFixtures() + public static function curlCommandFixtures(): array { return [ 'GET request' => ['basic-get'], From 95b1f46bcb6f9824c5ee7eb8c3085381a612b7e7 Mon Sep 17 00:00:00 2001 From: Jason McCreary Date: Sat, 23 Aug 2025 14:39:29 -0400 Subject: [PATCH 3/8] Migrate PHPUnit config --- phpunit.xml | 48 ++++++++++++++++++++++-------------------------- 1 file changed, 22 insertions(+), 26 deletions(-) diff --git a/phpunit.xml b/phpunit.xml index 9dc3ad8..bfa1b1c 100644 --- a/phpunit.xml +++ b/phpunit.xml @@ -1,28 +1,24 @@ - - - - ./tests/Feature - - - - - ./app - - - - - - - - - - - - - + + + + ./tests/Feature + + + + + + + + + + + + + + + + ./app + + From e65f40f193ad17a29e0bf01df506bb49b84329b2 Mon Sep 17 00:00:00 2001 From: Jason McCreary Date: Sat, 23 Aug 2025 14:40:45 -0400 Subject: [PATCH 4/8] Bump testing layer --- composer.json | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/composer.json b/composer.json index 8ea0f5a..6025ede 100644 --- a/composer.json +++ b/composer.json @@ -19,8 +19,8 @@ "require-dev": { "laravel/pint": "^1.24", "mockery/mockery": "^1.4.4", - "orchestra/testbench": "^7.0", - "phpunit/phpunit": "^10.0" + "orchestra/testbench": "^10.0", + "phpunit/phpunit": "^11.5" }, "autoload": { "psr-4": { From ab7de1fe648c9c4bbb06d70634f5b589b1d5e3a5 Mon Sep 17 00:00:00 2001 From: Jason McCreary Date: Sat, 23 Aug 2025 14:41:39 -0400 Subject: [PATCH 5/8] Avoid collision with Symonfy --- src/Console/Commands/CurlCommand.php | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/Console/Commands/CurlCommand.php b/src/Console/Commands/CurlCommand.php index 8ea27cd..1c3913d 100644 --- a/src/Console/Commands/CurlCommand.php +++ b/src/Console/Commands/CurlCommand.php @@ -7,7 +7,7 @@ class CurlCommand extends Command { - protected $signature = 'shift:curl {--X|request=} {--G|get} {--H|header=*} {--d|data=*} {--data-urlencode=*} {--data-raw=*} {--F|form=*} {--digest} {--basic} {--connect-timeout=} {--max-timeout=} {--retry=} {--s|silent} {--u|user=} {--L|location} {--compressed} {--insecure} {url}'; + protected $signature = 'shift:curl {--X|request=} {--G|get} {--H|header=*} {--d|data=*} {--data-urlencode=*} {--data-raw=*} {--F|form=*} {--digest} {--basic} {--connect-timeout=} {--max-timeout=} {--retry=} {--s|curl-silent} {--u|user=} {--L|location} {--compressed} {--insecure} {url}'; protected $description = 'Convert a UNIX curl request to an HTTP Client request'; @@ -38,7 +38,7 @@ private function gatherOptions() 'connectTimeout' => $this->option('connect-timeout'), 'maxTimeout' => $this->option('max-timeout'), 'retry' => $this->option('retry'), - 'silent' => $this->option('silent'), + 'silent' => $this->option('curl-silent'), 'user' => $this->option('user'), 'compressed' => $this->option('compressed'), 'insecure' => $this->option('insecure'), From 7f6bc9b22bb3a665d91588f356821cca2be18085 Mon Sep 17 00:00:00 2001 From: Jason McCreary Date: Sat, 23 Aug 2025 14:42:59 -0400 Subject: [PATCH 6/8] Bump CI --- .github/workflows/lint.yml | 2 +- .github/workflows/test.yml | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/.github/workflows/lint.yml b/.github/workflows/lint.yml index 41685fa..40abbf3 100644 --- a/.github/workflows/lint.yml +++ b/.github/workflows/lint.yml @@ -12,7 +12,7 @@ jobs: - name: Setup PHP uses: shivammathur/setup-php@v2 with: - php-version: '8.0' + php-version: '8.3' tools: phplint, laravel/pint - name: Check syntax run: phplint . diff --git a/.github/workflows/test.yml b/.github/workflows/test.yml index 1cc1559..c0c2b2c 100644 --- a/.github/workflows/test.yml +++ b/.github/workflows/test.yml @@ -7,7 +7,7 @@ jobs: runs-on: ubuntu-latest strategy: matrix: - php-version: ['8.0', '8.1', '8.2'] + php-version: ['8.3', '8.4'] steps: - name: Checkout uses: actions/checkout@v2 From 569608e472092692049338b798336bb2440ef4cd Mon Sep 17 00:00:00 2001 From: Jason McCreary Date: Sat, 23 Aug 2025 14:43:47 -0400 Subject: [PATCH 7/8] Pint --- tests/Feature/Console/Commands/CurlCommandTest.php | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/tests/Feature/Console/Commands/CurlCommandTest.php b/tests/Feature/Console/Commands/CurlCommandTest.php index c85f925..45033b5 100644 --- a/tests/Feature/Console/Commands/CurlCommandTest.php +++ b/tests/Feature/Console/Commands/CurlCommandTest.php @@ -2,10 +2,10 @@ namespace Tests\Feature\Console\Commands; -use PHPUnit\Framework\Attributes\DataProvider; -use PHPUnit\Framework\Attributes\Test; use Illuminate\Support\Facades\Artisan; use InvalidArgumentException; +use PHPUnit\Framework\Attributes\DataProvider; +use PHPUnit\Framework\Attributes\Test; use Tests\TestCase; final class CurlCommandTest extends TestCase From d3bd8a5c2d82c18fda7012dca6d58ec4981c889d Mon Sep 17 00:00:00 2001 From: Jason McCreary Date: Sat, 23 Aug 2025 14:47:46 -0400 Subject: [PATCH 8/8] GitHub Actions --- .github/workflows/test.yml | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/.github/workflows/test.yml b/.github/workflows/test.yml index c0c2b2c..2cd2863 100644 --- a/.github/workflows/test.yml +++ b/.github/workflows/test.yml @@ -19,12 +19,12 @@ jobs: coverage: none - name: Get composer cache directory id: composer-cache - run: echo "::set-output name=dir::$(composer config cache-files-dir)" + run: echo "dir=$(composer config cache-files-dir)" >> $GITHUB_OUTPUT - name: Setup composer cache - uses: actions/cache@v2 + uses: actions/cache@v4 with: path: ${{ steps.composer-cache.outputs.dir }} - key: ${{ runner.os }}-composer-${{ hashFiles('**/composer.lock') }} + key: ${{ runner.os }}-composer-${{ hashFiles('**/composer.json') }} restore-keys: ${{ runner.os }}-composer- - name: Install composer dependencies run: composer install --no-ansi --no-interaction --no-scripts --no-progress --prefer-dist