From cf6d6e9f06cf5937ec5426fc5845a739d87b5e3e Mon Sep 17 00:00:00 2001 From: mauricius Date: Sat, 25 Mar 2023 17:12:59 +0100 Subject: [PATCH 1/4] Add Laravel 10 compatibility --- .github/workflows/run-tests.yml | 5 +++-- composer.json | 9 ++++----- 2 files changed, 7 insertions(+), 7 deletions(-) diff --git a/.github/workflows/run-tests.yml b/.github/workflows/run-tests.yml index a786c51..c3d6d46 100644 --- a/.github/workflows/run-tests.yml +++ b/.github/workflows/run-tests.yml @@ -8,9 +8,11 @@ jobs: fail-fast: true matrix: php: [8.0, 8.1, 8.2] - laravel: [^8.80, 9.*] + laravel: [^8.80, 9.*, 10.*] dependency-version: [prefer-lowest, prefer-stable] include: + - laravel: 10.* + testbench: 8.* - laravel: 9.* testbench: 7.* - laravel: ^8.80 @@ -29,7 +31,6 @@ jobs: uses: shivammathur/setup-php@v2 with: php-version: ${{ matrix.php }} - extensions: dom, mbstring, libxml, pdo, sqlite, pdo_sqlite coverage: none - name: Install dependencies diff --git a/composer.json b/composer.json index cc67900..3ca1bd7 100644 --- a/composer.json +++ b/composer.json @@ -17,12 +17,12 @@ ], "require": { "php": "^8.0|^8.1|^8.2", - "illuminate/contracts": "^8.80|^9.0" + "illuminate/contracts": "^8.80|^9.0|^10.0" }, "require-dev": { - "nunomaduro/collision": "^5.0|^6.0", - "orchestra/testbench": "^6.0|^7.0", - "phpunit/phpunit": "^9.5", + "nunomaduro/collision": "^5.0|^6.0|^7.0", + "orchestra/testbench": "^6.0|^7.0|^8.0", + "phpunit/phpunit": "^9.5|^10.0", "spatie/phpunit-snapshot-assertions": "^4.2" }, "autoload": { @@ -37,7 +37,6 @@ }, "scripts": { "post-autoload-dump": "@php ./vendor/bin/testbench package:discover --ansi", - "analyse": "vendor/bin/phpstan analyse", "test": "vendor/bin/phpunit", "test-coverage": "vendor/bin/phpunit --coverage", "format": "vendor/bin/pint" From 4c02ed6c367c872054c5bbefd2720a790efc86d1 Mon Sep 17 00:00:00 2001 From: mauricius Date: Sat, 25 Mar 2023 17:13:30 +0100 Subject: [PATCH 2/4] Add Laravel Pint --- README.md | 2 +- composer.json | 5 +++++ pint.json | 3 +++ src/LaravelHtmxServiceProvider.php | 2 +- tests/Http/HtmxResponseTest.php | 12 +++++++++--- 5 files changed, 19 insertions(+), 5 deletions(-) create mode 100644 pint.json diff --git a/README.md b/README.md index 6993f5a..3b26910 100644 --- a/README.md +++ b/README.md @@ -3,7 +3,7 @@ Laravel integration for [htmx](https://htmx.org/). [![Latest Version on Packagist](https://img.shields.io/packagist/v/mauricius/laravel-htmx.svg?style=flat-square)](https://packagist.org/packages/mauricius/laravel-htmx) -[![GitHub Tests Action Status](https://img.shields.io/github/workflow/status/mauricius/laravel-htmx/run-tests?label=tests)](https://github.com/mauricius/laravel-htmx/actions?query=workflow%3Arun-tests+branch%3Amaster) +[![GitHub Tests Action Status](https://img.shields.io/github/actions/workflow/status/mauricius/laravel-htmx/run-tests.yml?branch=master&label=tests)](https://github.com/mauricius/laravel-htmx/actions?query=workflow%3Arun-tests+branch%3Amaster) [![Total Downloads](https://img.shields.io/packagist/dt/mauricius/laravel-htmx.svg?style=flat-square)](https://packagist.org/packages/mauricius/laravel-htmx) Supported Laravel Versions >= v8.80.0. diff --git a/composer.json b/composer.json index 3ca1bd7..cc25cf7 100644 --- a/composer.json +++ b/composer.json @@ -20,6 +20,7 @@ "illuminate/contracts": "^8.80|^9.0|^10.0" }, "require-dev": { + "laravel/pint": "^1.7", "nunomaduro/collision": "^5.0|^6.0|^7.0", "orchestra/testbench": "^6.0|^7.0|^8.0", "phpunit/phpunit": "^9.5|^10.0", @@ -41,6 +42,10 @@ "test-coverage": "vendor/bin/phpunit --coverage", "format": "vendor/bin/pint" }, + "scripts-descriptions": { + "test": "Runs phpunit to test the code.", + "format": "Runs Pint to fix project files." + }, "config": { "sort-packages": true }, diff --git a/pint.json b/pint.json new file mode 100644 index 0000000..ea5e72c --- /dev/null +++ b/pint.json @@ -0,0 +1,3 @@ +{ + "preset": "psr12" +} diff --git a/src/LaravelHtmxServiceProvider.php b/src/LaravelHtmxServiceProvider.php index 4c53fbe..4c666b1 100644 --- a/src/LaravelHtmxServiceProvider.php +++ b/src/LaravelHtmxServiceProvider.php @@ -31,7 +31,7 @@ public function boot() return BladeFragment::render($view, $fragment, $data); }); } - + /** * Console-specific booting. * diff --git a/tests/Http/HtmxResponseTest.php b/tests/Http/HtmxResponseTest.php index 4a392ef..e45e05e 100644 --- a/tests/Http/HtmxResponseTest.php +++ b/tests/Http/HtmxResponseTest.php @@ -83,7 +83,9 @@ public function the_response_should_trigger_a_client_side_event_by_setting_the_h /** @test */ public function the_response_supports_triggering_multiple_events() { - Route::get('test', fn () => with(new HtmxResponse()) + Route::get( + 'test', + fn () => with(new HtmxResponse()) ->addTrigger('htmx:abort') ->addTrigger('htmx:load') ); @@ -108,7 +110,9 @@ public function the_response_should_trigger_a_client_side_event_after_the_settli /** @test */ public function the_response_supports_triggering_after_settle_multiple_events() { - Route::get('test', fn () => with(new HtmxResponse()) + Route::get( + 'test', + fn () => with(new HtmxResponse()) ->addTriggerAfterSettle('htmx:abort') ->addTriggerAfterSettle('htmx:load') ); @@ -133,7 +137,9 @@ public function the_response_should_trigger_a_client_side_event_after_the_swap_s /** @test */ public function the_response_supports_triggering_after_swap_multiple_multiple_events() { - Route::get('test', fn () => with(new HtmxResponse()) + Route::get( + 'test', + fn () => with(new HtmxResponse()) ->addTriggerAfterSwap('htmx:abort') ->addTriggerAfterSwap('htmx:load') ); From 9fe418160bed52371bab8e97ecc6657005cc441b Mon Sep 17 00:00:00 2001 From: mauricius Date: Sat, 25 Mar 2023 17:45:30 +0100 Subject: [PATCH 3/4] Remove Pint --- composer.json | 7 ++----- pint.json | 3 --- 2 files changed, 2 insertions(+), 8 deletions(-) delete mode 100644 pint.json diff --git a/composer.json b/composer.json index cc25cf7..421ddad 100644 --- a/composer.json +++ b/composer.json @@ -20,7 +20,6 @@ "illuminate/contracts": "^8.80|^9.0|^10.0" }, "require-dev": { - "laravel/pint": "^1.7", "nunomaduro/collision": "^5.0|^6.0|^7.0", "orchestra/testbench": "^6.0|^7.0|^8.0", "phpunit/phpunit": "^9.5|^10.0", @@ -39,12 +38,10 @@ "scripts": { "post-autoload-dump": "@php ./vendor/bin/testbench package:discover --ansi", "test": "vendor/bin/phpunit", - "test-coverage": "vendor/bin/phpunit --coverage", - "format": "vendor/bin/pint" + "test-coverage": "vendor/bin/phpunit --coverage" }, "scripts-descriptions": { - "test": "Runs phpunit to test the code.", - "format": "Runs Pint to fix project files." + "test": "Runs phpunit to test the code." }, "config": { "sort-packages": true diff --git a/pint.json b/pint.json deleted file mode 100644 index ea5e72c..0000000 --- a/pint.json +++ /dev/null @@ -1,3 +0,0 @@ -{ - "preset": "psr12" -} From 44b6f0d17ab123088955c45bffa9fc494351029e Mon Sep 17 00:00:00 2001 From: mauricius Date: Sat, 25 Mar 2023 17:48:08 +0100 Subject: [PATCH 4/4] Exclude php 8.0 for Laravel 10 --- .github/workflows/run-tests.yml | 2 ++ 1 file changed, 2 insertions(+) diff --git a/.github/workflows/run-tests.yml b/.github/workflows/run-tests.yml index c3d6d46..b6263c8 100644 --- a/.github/workflows/run-tests.yml +++ b/.github/workflows/run-tests.yml @@ -18,6 +18,8 @@ jobs: - laravel: ^8.80 testbench: 6.23 exclude: + - laravel: 10.* + php: 8.0 - laravel: ^8.80 php: 8.2