From 69b58714d775adccf111452b04f153adabe59113 Mon Sep 17 00:00:00 2001 From: Ashley Hindle Date: Wed, 18 Jun 2025 13:13:47 +0100 Subject: [PATCH 01/11] feat: add initial CI changes for laravel 10 support --- .github/workflows/run-tests.yml | 6 ++++-- composer.json | 10 +++++----- tests/Commands/CroftInstallCursorCommandTest.php | 11 ++++++++--- tests/Pest.php | 2 +- 4 files changed, 18 insertions(+), 11 deletions(-) diff --git a/.github/workflows/run-tests.yml b/.github/workflows/run-tests.yml index d8b267a..28223a3 100644 --- a/.github/workflows/run-tests.yml +++ b/.github/workflows/run-tests.yml @@ -17,14 +17,16 @@ jobs: fail-fast: true matrix: os: [ubuntu-latest, windows-latest] - php: [8.4, 8.3, 8.2] - laravel: [12.*, 11.*] + php: [8.4, 8.3, 8.2, 8.1] + laravel: [12.*, 11.*, 10.*] stability: [prefer-lowest, prefer-stable] include: - laravel: 12.* testbench: 10.* - laravel: 11.* testbench: 9.* + - laravel: 10.* + testbench: 9.* name: P${{ matrix.php }} - L${{ matrix.laravel }} - ${{ matrix.stability }} - ${{ matrix.os }} diff --git a/composer.json b/composer.json index e275065..6fb8a61 100644 --- a/composer.json +++ b/composer.json @@ -16,8 +16,8 @@ } ], "require": { - "php": "^8.2", - "illuminate/contracts": "^11.0||^12.0", + "php": "^8.1||^8.2", + "illuminate/contracts": "^10.0||^11.0||^12.0", "spatie/laravel-package-tools": "^1.16" }, "require-dev": { @@ -25,9 +25,9 @@ "nunomaduro/collision": "^8.1.1||^7.10.0", "larastan/larastan": "^2.9||^3.0", "orchestra/testbench": "^10.0.0||^9.0.0||^8.22.0", - "pestphp/pest": "^3.0", - "pestphp/pest-plugin-arch": "^3.0", - "pestphp/pest-plugin-laravel": "^3.0", + "pestphp/pest": "^2.0||^3.0", + "pestphp/pest-plugin-arch": "^2.0||^3.0", + "pestphp/pest-plugin-laravel": "^2.0||^3.0", "phpstan/extension-installer": "^1.3||^2.0", "phpstan/phpstan-deprecation-rules": "^1.1||^2.0", "phpstan/phpstan-phpunit": "^1.3||^2.0" diff --git a/tests/Commands/CroftInstallCursorCommandTest.php b/tests/Commands/CroftInstallCursorCommandTest.php index f3cd663..0ac350e 100644 --- a/tests/Commands/CroftInstallCursorCommandTest.php +++ b/tests/Commands/CroftInstallCursorCommandTest.php @@ -6,9 +6,14 @@ beforeEach(function () { // Clean up created directories and files after each test File::delete(base_path('.cursor/mcp.json')); - - if (file_exists(base_path('.cursor'))) { - rmdir(base_path('.cursor')); + $dir = base_path('.cursor'); + + if (file_exists($dir)) { + if (is_dir($dir)) { + rmdir(base_path('.cursor')); + } else { + unlink($dir); + } } }); diff --git a/tests/Pest.php b/tests/Pest.php index f8be6f9..09e2fe2 100644 --- a/tests/Pest.php +++ b/tests/Pest.php @@ -6,5 +6,5 @@ function getEditorChoices(): array { - return ['cursor' => 'Cursor', 'windsurf' => 'Windsurf', 'phpstorm' => 'PhpStorm (coming soon)']; + return ['cursor' => 'Cursor', 'windsurf' => 'Windsurf', 'phpstorm' => 'PhpStorm (coming soon)', 'cursor', 'phpstorm', 'windsurf']; } From 861b102fcecd4020f5d39db303c622f590926141 Mon Sep 17 00:00:00 2001 From: Ashley Hindle Date: Wed, 18 Jun 2025 13:15:22 +0100 Subject: [PATCH 02/11] chore: update testbench version to 8 for laravel 10 tests --- .github/workflows/run-tests.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/run-tests.yml b/.github/workflows/run-tests.yml index 28223a3..eeddcb9 100644 --- a/.github/workflows/run-tests.yml +++ b/.github/workflows/run-tests.yml @@ -26,7 +26,7 @@ jobs: - laravel: 11.* testbench: 9.* - laravel: 10.* - testbench: 9.* + testbench: 8.* name: P${{ matrix.php }} - L${{ matrix.laravel }} - ${{ matrix.stability }} - ${{ matrix.os }} From a8bc73f8cf68a9fb7bd04165332be65d460aed3b Mon Sep 17 00:00:00 2001 From: Ashley Hindle Date: Wed, 18 Jun 2025 13:19:10 +0100 Subject: [PATCH 03/11] chore: exclude Laravel 12 on 8.1 tests --- .github/workflows/run-tests.yml | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/.github/workflows/run-tests.yml b/.github/workflows/run-tests.yml index eeddcb9..1d18ade 100644 --- a/.github/workflows/run-tests.yml +++ b/.github/workflows/run-tests.yml @@ -27,6 +27,10 @@ jobs: testbench: 9.* - laravel: 10.* testbench: 8.* + exclude: + - php: 8.1 + laravel: 12.* + name: P${{ matrix.php }} - L${{ matrix.laravel }} - ${{ matrix.stability }} - ${{ matrix.os }} From ec03834c309b1389212e2b053c7ae58f86e13fe4 Mon Sep 17 00:00:00 2001 From: Ashley Hindle Date: Wed, 18 Jun 2025 13:20:04 +0100 Subject: [PATCH 04/11] chore: exclude laravel 11 on php8.1 tests --- .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 1d18ade..2252da4 100644 --- a/.github/workflows/run-tests.yml +++ b/.github/workflows/run-tests.yml @@ -30,6 +30,8 @@ jobs: exclude: - php: 8.1 laravel: 12.* + - php: 8.1 + laravel: 11.* name: P${{ matrix.php }} - L${{ matrix.laravel }} - ${{ matrix.stability }} - ${{ matrix.os }} From 6d90316177eeece68336d4671160551f184b941a Mon Sep 17 00:00:00 2001 From: Ashley Hindle Date: Wed, 18 Jun 2025 13:25:01 +0100 Subject: [PATCH 05/11] fix: conditional editor choices in tests https://github.com/laravel/framework/pull/52408 --- tests/Pest.php | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/tests/Pest.php b/tests/Pest.php index 09e2fe2..f10a775 100644 --- a/tests/Pest.php +++ b/tests/Pest.php @@ -2,9 +2,15 @@ use Croft\Tests\TestCase; +use function Orchestra\Testbench\laravel_version_compare; + uses(TestCase::class)->in(__DIR__); function getEditorChoices(): array { - return ['cursor' => 'Cursor', 'windsurf' => 'Windsurf', 'phpstorm' => 'PhpStorm (coming soon)', 'cursor', 'phpstorm', 'windsurf']; + $choices = ['cursor' => 'Cursor', 'windsurf' => 'Windsurf', 'phpstorm' => 'PhpStorm (coming soon)']; + if (laravel_version_compare('11.20', '<=')) { + $choices = array_merge($choices, ['cursor', 'phpstorm', 'windsurf']); + } + return $choices; } From c06438a22e108c52a9d2a52c4c1dc4d7a4051da3 Mon Sep 17 00:00:00 2001 From: ashleyhindle <454975+ashleyhindle@users.noreply.github.com> Date: Wed, 18 Jun 2025 12:25:15 +0000 Subject: [PATCH 06/11] Fix styling --- tests/Pest.php | 1 + 1 file changed, 1 insertion(+) diff --git a/tests/Pest.php b/tests/Pest.php index f10a775..5191d89 100644 --- a/tests/Pest.php +++ b/tests/Pest.php @@ -12,5 +12,6 @@ function getEditorChoices(): array if (laravel_version_compare('11.20', '<=')) { $choices = array_merge($choices, ['cursor', 'phpstorm', 'windsurf']); } + return $choices; } From 541026bb80f9017b73a3bcb2b80e7c3710d395c0 Mon Sep 17 00:00:00 2001 From: Ashley Hindle Date: Wed, 18 Jun 2025 13:31:39 +0100 Subject: [PATCH 07/11] chore: simplify test matrix with repetition --- .github/workflows/run-tests.yml | 54 +++++++++++++++++++++++++++------ 1 file changed, 44 insertions(+), 10 deletions(-) diff --git a/.github/workflows/run-tests.yml b/.github/workflows/run-tests.yml index 2252da4..9bd92d8 100644 --- a/.github/workflows/run-tests.yml +++ b/.github/workflows/run-tests.yml @@ -17,22 +17,14 @@ jobs: fail-fast: true matrix: os: [ubuntu-latest, windows-latest] - php: [8.4, 8.3, 8.2, 8.1] - laravel: [12.*, 11.*, 10.*] + php: [8.4, 8.3, 8.2] + laravel: [12.*, 11.*] stability: [prefer-lowest, prefer-stable] include: - laravel: 12.* testbench: 10.* - laravel: 11.* testbench: 9.* - - laravel: 10.* - testbench: 8.* - exclude: - - php: 8.1 - laravel: 12.* - - php: 8.1 - laravel: 11.* - name: P${{ matrix.php }} - L${{ matrix.laravel }} - ${{ matrix.stability }} - ${{ matrix.os }} @@ -62,3 +54,45 @@ jobs: - name: Execute tests run: vendor/bin/pest --ci + test-l10: + runs-on: ${{ matrix.os }} + timeout-minutes: 5 + strategy: + fail-fast: true + matrix: + os: [ubuntu-latest, windows-latest] + php: [8.1] + laravel: [10.*] + stability: [prefer-lowest, prefer-stable] + include: + - laravel: 10.* + testbench: 8.* + + name: P${{ matrix.php }} - L${{ matrix.laravel }} - ${{ matrix.stability }} - ${{ matrix.os }} + + steps: + - name: Checkout code + uses: actions/checkout@v4 + + - name: Setup PHP + uses: shivammathur/setup-php@v2 + with: + php-version: ${{ matrix.php }} + extensions: dom, curl, libxml, mbstring, zip, pcntl, pdo, sqlite, pdo_sqlite, bcmath, soap, intl, gd, exif, iconv, imagick, fileinfo + coverage: none + + - name: Setup problem matchers + run: | + echo "::add-matcher::${{ runner.tool_cache }}/php.json" + echo "::add-matcher::${{ runner.tool_cache }}/phpunit.json" + + - name: Install dependencies + run: | + composer require "laravel/framework:${{ matrix.laravel }}" "orchestra/testbench:${{ matrix.testbench }}" --no-interaction --no-update + composer update --${{ matrix.stability }} --prefer-dist --no-interaction + + - name: List Installed Dependencies + run: composer show -D + + - name: Execute tests + run: vendor/bin/pest --ci From f08fd7eb75c4a2142bca905744a2b115f2a13023 Mon Sep 17 00:00:00 2001 From: Ashley Hindle Date: Wed, 18 Jun 2025 13:35:59 +0100 Subject: [PATCH 08/11] chore: conditional test based on laravel version --- tests/Pest.php | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/tests/Pest.php b/tests/Pest.php index 5191d89..98b41b0 100644 --- a/tests/Pest.php +++ b/tests/Pest.php @@ -9,8 +9,8 @@ function getEditorChoices(): array { $choices = ['cursor' => 'Cursor', 'windsurf' => 'Windsurf', 'phpstorm' => 'PhpStorm (coming soon)']; - if (laravel_version_compare('11.20', '<=')) { - $choices = array_merge($choices, ['cursor', 'phpstorm', 'windsurf']); + if (laravel_version_compare('12', '<')) { + $choices = ['Cursor', 'PhpStorm (coming soon)', 'Windsurf', 'cursor', 'phpstorm', 'windsurf']; } return $choices; From 307d0cea5dc1c636d751086bcdc0d53596dfea07 Mon Sep 17 00:00:00 2001 From: Ashley Hindle Date: Wed, 18 Jun 2025 13:37:30 +0100 Subject: [PATCH 09/11] chore: fix CI with direct choice question call so no conditional required --- tests/Pest.php | 10 +++------- 1 file changed, 3 insertions(+), 7 deletions(-) diff --git a/tests/Pest.php b/tests/Pest.php index 98b41b0..db12554 100644 --- a/tests/Pest.php +++ b/tests/Pest.php @@ -1,17 +1,13 @@ in(__DIR__); function getEditorChoices(): array { - $choices = ['cursor' => 'Cursor', 'windsurf' => 'Windsurf', 'phpstorm' => 'PhpStorm (coming soon)']; - if (laravel_version_compare('12', '<')) { - $choices = ['Cursor', 'PhpStorm (coming soon)', 'Windsurf', 'cursor', 'phpstorm', 'windsurf']; - } + $choices = new ChoiceQuestion('Which editor are you using?', ['cursor' => 'Cursor', 'windsurf' => 'Windsurf', 'phpstorm' => 'PhpStorm (coming soon)']); - return $choices; + return $choices->getAutocompleterValues(); } From e50714305df0407d336c276f1330b0c7a6ccab4d Mon Sep 17 00:00:00 2001 From: Ashley Hindle Date: Wed, 18 Jun 2025 13:42:55 +0100 Subject: [PATCH 10/11] chore: only call arch tests if available --- tests/ArchTest.php | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) diff --git a/tests/ArchTest.php b/tests/ArchTest.php index 87fb64c..0369e01 100644 --- a/tests/ArchTest.php +++ b/tests/ArchTest.php @@ -1,5 +1,7 @@ expect(['dd', 'dump', 'ray']) - ->each->not->toBeUsed(); +if (function_exists('arch')) { + arch('it will not use debugging functions') + ->expect(['dd', 'dump', 'ray']) + ->each->not->toBeUsed(); +} From 39683a68ea9c4a8d8e2f1bcc2cc7f7959fefbb5f Mon Sep 17 00:00:00 2001 From: Ashley Hindle Date: Wed, 18 Jun 2025 13:45:51 +0100 Subject: [PATCH 11/11] chore: prefer stable only for 8.1 and 10 --- .github/workflows/run-tests.yml | 2 +- composer.json | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/.github/workflows/run-tests.yml b/.github/workflows/run-tests.yml index 9bd92d8..b157436 100644 --- a/.github/workflows/run-tests.yml +++ b/.github/workflows/run-tests.yml @@ -63,7 +63,7 @@ jobs: os: [ubuntu-latest, windows-latest] php: [8.1] laravel: [10.*] - stability: [prefer-lowest, prefer-stable] + stability: [prefer-stable] include: - laravel: 10.* testbench: 8.* diff --git a/composer.json b/composer.json index 6fb8a61..87f2cea 100644 --- a/composer.json +++ b/composer.json @@ -1,6 +1,6 @@ { "name": "usecroft/laravel", - "description": "MCP server for all of your Laravel projects - better AI pair programming, coming soon.. ", + "description": "MCP server for all of your Laravel projects - better AI pair programming", "keywords": [ "laravel", "mcp",