From ff954f129e10eb4b2032ba44db02064729a4f89b Mon Sep 17 00:00:00 2001 From: Marc Janga Date: Tue, 15 Sep 2026 15:37:39 +0200 Subject: [PATCH] Add Laravel 13 support - Allow illuminate/* ^13.0 and orchestra/testbench ^11.0 - Bind the test command via setApplication(), since Symfony Console 8 (Laravel 13) removed Application::add() - Test every supported PHP x Laravel combination in CI; previously every job installed the Laravel 10 lock file Co-Authored-By: Claude Opus 5 --- .github/workflows/tests.yml | 39 ++++++++++++++++++++++++++--- composer.json | 8 +++--- composer.lock | 2 +- tests/Unit/CommandInspectorTest.php | 4 ++- 4 files changed, 44 insertions(+), 9 deletions(-) diff --git a/.github/workflows/tests.yml b/.github/workflows/tests.yml index 1d6c530..442edff 100644 --- a/.github/workflows/tests.yml +++ b/.github/workflows/tests.yml @@ -13,13 +13,34 @@ env: jobs: test: - name: PHP ${{ matrix.php }} + name: PHP ${{ matrix.php }} - Laravel ${{ matrix.laravel }} runs-on: ubuntu-latest strategy: - fail-fast: true + fail-fast: false matrix: php: ["8.1", "8.2", "8.3", "8.4", "8.5"] + laravel: ["10.*", "11.*", "12.*", "13.*"] + include: + - laravel: "10.*" + testbench: "8.*" + - laravel: "11.*" + testbench: "9.*" + - laravel: "12.*" + testbench: "10.*" + - laravel: "13.*" + testbench: "11.*" + exclude: + # Laravel 11 and 12 require PHP 8.2+ + - php: "8.1" + laravel: "11.*" + - php: "8.1" + laravel: "12.*" + # Laravel 13 requires PHP 8.3+ + - php: "8.1" + laravel: "13.*" + - php: "8.2" + laravel: "13.*" steps: - name: Checkout code @@ -32,8 +53,20 @@ jobs: extensions: dom, curl, libxml, mbstring, zip, pcntl, pdo, sqlite, pdo_sqlite, bcmath, soap, intl, gd, exif, iconv coverage: none + # The committed lock file and the platform pin in composer.json target the + # lowest supported stack (PHP 8.1 / Laravel 10). Drop the pin and resolve + # fresh so each job actually tests its own Laravel version. + # + # --no-security-blocking: end-of-life Laravel releases (10.x, 11.x) carry + # unpatched advisories, which Composer refuses to install by default. That + # only matters for applications; here we just need the framework to test + # against. - name: Install dependencies - run: composer install --prefer-dist --no-interaction + run: | + composer config --unset platform.php + composer require "illuminate/console:${{ matrix.laravel }}" "illuminate/contracts:${{ matrix.laravel }}" "illuminate/support:${{ matrix.laravel }}" --no-interaction --no-update + composer require --dev "orchestra/testbench:${{ matrix.testbench }}" --no-interaction --no-update + composer update --prefer-dist --no-interaction --no-security-blocking - name: Run linting run: composer lint diff --git a/composer.json b/composer.json index cd11965..ecee26c 100644 --- a/composer.json +++ b/composer.json @@ -12,12 +12,12 @@ ], "require": { "php": "^8.1", - "illuminate/console": "^10.0|^11.0|^12.0", - "illuminate/contracts": "^10.0|^11.0|^12.0", - "illuminate/support": "^10.0|^11.0|^12.0" + "illuminate/console": "^10.0|^11.0|^12.0|^13.0", + "illuminate/contracts": "^10.0|^11.0|^12.0|^13.0", + "illuminate/support": "^10.0|^11.0|^12.0|^13.0" }, "require-dev": { - "orchestra/testbench": "^8.0|^9.0|^10.0", + "orchestra/testbench": "^8.0|^9.0|^10.0|^11.0", "phpunit/phpunit": "^10.0|^11.0", "laravel/pint": "^1.0" }, diff --git a/composer.lock b/composer.lock index 511697d..9c07b50 100644 --- a/composer.lock +++ b/composer.lock @@ -4,7 +4,7 @@ "Read more about it at https://getcomposer.org/doc/01-basic-usage.md#installing-dependencies", "This file is @generated automatically" ], - "content-hash": "c70936de27ba6bb010374be8132e49ed", + "content-hash": "4fa00a8ac015d549409d2f41f1c959eb", "packages": [ { "name": "brick/math", diff --git a/tests/Unit/CommandInspectorTest.php b/tests/Unit/CommandInspectorTest.php index c856bc0..80df135 100644 --- a/tests/Unit/CommandInspectorTest.php +++ b/tests/Unit/CommandInspectorTest.php @@ -276,7 +276,9 @@ protected function execute($input, $output): int } }; - $application->add($command); + // Application::add() was removed in Symfony Console 8 (Laravel 13); + // setApplication() binds the command on every supported version. + $command->setApplication($application); $meta = $this->inspector->inspect($command); $optionNames = array_column($meta['options'], 'name');