Skip to content

Commit 945538f

Browse files
Latest supported Laravel versions (#38)
1 parent 4b50015 commit 945538f

File tree

7 files changed

+53
-51
lines changed

7 files changed

+53
-51
lines changed

.github/workflows/lint.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,7 @@ jobs:
1212
- name: Setup PHP
1313
uses: shivammathur/setup-php@v2
1414
with:
15-
php-version: '8.0'
15+
php-version: '8.3'
1616
tools: phplint, laravel/pint
1717
- name: Check syntax
1818
run: phplint .

.github/workflows/test.yml

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@ jobs:
77
runs-on: ubuntu-latest
88
strategy:
99
matrix:
10-
php-version: ['8.0', '8.1', '8.2']
10+
php-version: ['8.3', '8.4']
1111
steps:
1212
- name: Checkout
1313
uses: actions/checkout@v2
@@ -19,12 +19,12 @@ jobs:
1919
coverage: none
2020
- name: Get composer cache directory
2121
id: composer-cache
22-
run: echo "::set-output name=dir::$(composer config cache-files-dir)"
22+
run: echo "dir=$(composer config cache-files-dir)" >> $GITHUB_OUTPUT
2323
- name: Setup composer cache
24-
uses: actions/cache@v2
24+
uses: actions/cache@v4
2525
with:
2626
path: ${{ steps.composer-cache.outputs.dir }}
27-
key: ${{ runner.os }}-composer-${{ hashFiles('**/composer.lock') }}
27+
key: ${{ runner.os }}-composer-${{ hashFiles('**/composer.json') }}
2828
restore-keys: ${{ runner.os }}-composer-
2929
- name: Install composer dependencies
3030
run: composer install --no-ansi --no-interaction --no-scripts --no-progress --prefer-dist

.gitignore

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@
66
/vendor
77
.env
88
.env.backup
9-
.phpunit.result.cache
9+
/.phpunit.cache
1010
Homestead.json
1111
Homestead.yaml
1212
auth.json

composer.json

Lines changed: 14 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -2,19 +2,25 @@
22
"name": "laravel-shift/curl-converter",
33
"description": "A command line tool to convert curl requests to Laravel HTTP requests.",
44
"type": "library",
5-
"keywords": ["curl", "converter", "http", "laravel", "shift"],
5+
"keywords": [
6+
"curl",
7+
"converter",
8+
"http",
9+
"laravel",
10+
"shift"
11+
],
612
"license": "MIT",
713
"require": {
8-
"php": "^8.0",
9-
"illuminate/console": "^9.0|^10.0",
10-
"illuminate/support": "^9.0|^10.0",
11-
"symfony/var-exporter": "^6.3"
14+
"php": "^8.3",
15+
"illuminate/console": "^11.0|^12.0",
16+
"illuminate/support": "^11.0|^12.0",
17+
"symfony/var-exporter": "^7.0"
1218
},
1319
"require-dev": {
14-
"laravel/pint": "^1.1",
20+
"laravel/pint": "^1.24",
1521
"mockery/mockery": "^1.4.4",
16-
"orchestra/testbench": "^7.0",
17-
"phpunit/phpunit": "^9.5.10"
22+
"orchestra/testbench": "^10.0",
23+
"phpunit/phpunit": "^11.5"
1824
},
1925
"autoload": {
2026
"psr-4": {

phpunit.xml

Lines changed: 22 additions & 26 deletions
Original file line numberDiff line numberDiff line change
@@ -1,28 +1,24 @@
11
<?xml version="1.0" encoding="UTF-8"?>
2-
<phpunit xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
3-
xsi:noNamespaceSchemaLocation="./vendor/phpunit/phpunit/phpunit.xsd"
4-
bootstrap="vendor/autoload.php"
5-
colors="true"
6-
>
7-
<testsuites>
8-
<testsuite name="Feature">
9-
<directory suffix="Test.php">./tests/Feature</directory>
10-
</testsuite>
11-
</testsuites>
12-
<coverage processUncoveredFiles="true">
13-
<include>
14-
<directory suffix=".php">./app</directory>
15-
</include>
16-
</coverage>
17-
<php>
18-
<env name="APP_ENV" value="testing"/>
19-
<env name="BCRYPT_ROUNDS" value="4"/>
20-
<env name="CACHE_DRIVER" value="array"/>
21-
<!-- <env name="DB_CONNECTION" value="sqlite"/> -->
22-
<!-- <env name="DB_DATABASE" value=":memory:"/> -->
23-
<env name="MAIL_MAILER" value="array"/>
24-
<env name="QUEUE_CONNECTION" value="sync"/>
25-
<env name="SESSION_DRIVER" value="array"/>
26-
<env name="TELESCOPE_ENABLED" value="false"/>
27-
</php>
2+
<phpunit xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="./vendor/phpunit/phpunit/phpunit.xsd" bootstrap="vendor/autoload.php" colors="true" cacheDirectory=".phpunit.cache">
3+
<testsuites>
4+
<testsuite name="Feature">
5+
<directory suffix="Test.php">./tests/Feature</directory>
6+
</testsuite>
7+
</testsuites>
8+
<php>
9+
<env name="APP_ENV" value="testing"/>
10+
<env name="BCRYPT_ROUNDS" value="4"/>
11+
<env name="CACHE_DRIVER" value="array"/>
12+
<!-- <env name="DB_CONNECTION" value="sqlite"/> -->
13+
<!-- <env name="DB_DATABASE" value=":memory:"/> -->
14+
<env name="MAIL_MAILER" value="array"/>
15+
<env name="QUEUE_CONNECTION" value="sync"/>
16+
<env name="SESSION_DRIVER" value="array"/>
17+
<env name="TELESCOPE_ENABLED" value="false"/>
18+
</php>
19+
<source>
20+
<include>
21+
<directory suffix=".php">./app</directory>
22+
</include>
23+
</source>
2824
</phpunit>

src/Console/Commands/CurlCommand.php

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@
77

88
class CurlCommand extends Command
99
{
10-
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}';
10+
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}';
1111

1212
protected $description = 'Convert a UNIX curl request to an HTTP Client request';
1313

@@ -38,7 +38,7 @@ private function gatherOptions()
3838
'connectTimeout' => $this->option('connect-timeout'),
3939
'maxTimeout' => $this->option('max-timeout'),
4040
'retry' => $this->option('retry'),
41-
'silent' => $this->option('silent'),
41+
'silent' => $this->option('curl-silent'),
4242
'user' => $this->option('user'),
4343
'compressed' => $this->option('compressed'),
4444
'insecure' => $this->option('insecure'),

tests/Feature/Console/Commands/CurlCommandTest.php

Lines changed: 9 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -4,15 +4,15 @@
44

55
use Illuminate\Support\Facades\Artisan;
66
use InvalidArgumentException;
7+
use PHPUnit\Framework\Attributes\DataProvider;
8+
use PHPUnit\Framework\Attributes\Test;
79
use 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'],

0 commit comments

Comments
 (0)