From 7efdb796d52fa984d0917ea516377e26a08baa65 Mon Sep 17 00:00:00 2001 From: Riley Aven Date: Mon, 28 Oct 2024 19:22:15 -0400 Subject: [PATCH 1/3] support laravel 11 development --- .github/workflows/run-tests.yml | 10 ++++++++-- composer.json | 8 ++++---- .../CopyAndRegisterServiceProviderInAppTest.php | 4 ++++ 3 files changed, 16 insertions(+), 6 deletions(-) diff --git a/.github/workflows/run-tests.yml b/.github/workflows/run-tests.yml index 5994bfb..bfa85a5 100644 --- a/.github/workflows/run-tests.yml +++ b/.github/workflows/run-tests.yml @@ -10,16 +10,22 @@ jobs: matrix: os: [ubuntu-latest, windows-latest] php: [8.0, 8.1, 8.2] - laravel: [10.*, 9.*] + laravel: [11.*, 10.*, 9.*] stability: [prefer-lowest, prefer-stable] include: - laravel: 9.* testbench: 7.* - laravel: 10.* testbench: 8.* + - laravel: 11.* + testbench: 9.* exclude: - laravel: 10.* php: 8.0 + - laravel: 11.* + php: 8.0 + - laravel: 11.* + php: 8.1 name: P${{ matrix.php }} - L${{ matrix.laravel }} - ${{ matrix.stability }} - ${{ matrix.os }} @@ -41,7 +47,7 @@ jobs: - name: Install dependencies run: | - composer require "laravel/framework:${{ matrix.laravel }}" "orchestra/testbench:${{ matrix.testbench }}" "nesbot/carbon:^2.64.1" --no-interaction --no-update + composer require "laravel/framework:${{ matrix.laravel }}" "orchestra/testbench:${{ matrix.testbench }}" "nesbot/carbon:^2.72.2" --no-interaction --no-update composer update --${{ matrix.stability }} --prefer-dist --no-interaction - name: Execute tests diff --git a/composer.json b/composer.json index f9035af..b586185 100644 --- a/composer.json +++ b/composer.json @@ -20,10 +20,10 @@ }, "require-dev": { "mockery/mockery": "^1.5", - "orchestra/testbench": "^7.7|^8.0", - "pestphp/pest": "^1.22", - "phpunit/phpunit": "^9.5.24", - "spatie/pest-plugin-test-time": "^1.1" + "orchestra/testbench": "^7.7|^8.0|^9.0", + "pestphp/pest": "^1.22|^2", + "phpunit/phpunit": "^9.5.24|^10.5", + "spatie/pest-plugin-test-time": "^1.1|^2.2" }, "autoload": { "psr-4": { diff --git a/tests/PackageServiceProviderTests/InstallCommandTests/CopyAndRegisterServiceProviderInAppTest.php b/tests/PackageServiceProviderTests/InstallCommandTests/CopyAndRegisterServiceProviderInAppTest.php index d7c6869..be34028 100644 --- a/tests/PackageServiceProviderTests/InstallCommandTests/CopyAndRegisterServiceProviderInAppTest.php +++ b/tests/PackageServiceProviderTests/InstallCommandTests/CopyAndRegisterServiceProviderInAppTest.php @@ -36,6 +36,10 @@ function restoreAppConfigFile(): void uses(ConfigureCopyAndRegisterServiceProviderInAppTest::class); it('can copy and register the service provider in the app', function () { + if (intval(app()->version()) >= 11) { + $this->markTestSkipped('Respects Laravel 11 skeleton patterns'); + } + $this ->artisan('package-tools:install') ->assertSuccessful(); From 843620e6b0d6b55efdb6004339028c4323128222 Mon Sep 17 00:00:00 2001 From: Riley Aven Date: Mon, 28 Oct 2024 19:31:26 -0400 Subject: [PATCH 2/3] Update assertion for L11 --- ...opyAndRegisterServiceProviderInAppTest.php | 21 ++++++++++++------- 1 file changed, 13 insertions(+), 8 deletions(-) diff --git a/tests/PackageServiceProviderTests/InstallCommandTests/CopyAndRegisterServiceProviderInAppTest.php b/tests/PackageServiceProviderTests/InstallCommandTests/CopyAndRegisterServiceProviderInAppTest.php index be34028..1e4ecef 100644 --- a/tests/PackageServiceProviderTests/InstallCommandTests/CopyAndRegisterServiceProviderInAppTest.php +++ b/tests/PackageServiceProviderTests/InstallCommandTests/CopyAndRegisterServiceProviderInAppTest.php @@ -3,6 +3,7 @@ use function PHPUnit\Framework\assertStringContainsString; use Spatie\LaravelPackageTools\Commands\InstallCommand; use Spatie\LaravelPackageTools\Package; +use function PHPUnit\Framework\assertStringNotContainsString; trait ConfigureCopyAndRegisterServiceProviderInAppTest { @@ -36,18 +37,22 @@ function restoreAppConfigFile(): void uses(ConfigureCopyAndRegisterServiceProviderInAppTest::class); it('can copy and register the service provider in the app', function () { - if (intval(app()->version()) >= 11) { - $this->markTestSkipped('Respects Laravel 11 skeleton patterns'); - } - $this ->artisan('package-tools:install') ->assertSuccessful(); - assertStringContainsString( - "App\Providers\MyPackageServiceProvider::class", - file_get_contents(base_path('config/app.php')) - ); + if (intval(app()->version()) >= 11) { + // This does not happen in L11 because of the different framework skeleton + assertStringNotContainsString( + "App\Providers\MyPackageServiceProvider::class", + file_get_contents(base_path('config/app.php')) + ); + } else { + assertStringContainsString( + "App\Providers\MyPackageServiceProvider::class", + file_get_contents(base_path('config/app.php')) + ); + } restoreAppConfigFile(); }); From 3588bc912f58f9c77b229d4b1263f9945a2adab2 Mon Sep 17 00:00:00 2001 From: Riley19280 Date: Mon, 28 Oct 2024 23:32:06 +0000 Subject: [PATCH 3/3] Fix styling --- .../CopyAndRegisterServiceProviderInAppTest.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/tests/PackageServiceProviderTests/InstallCommandTests/CopyAndRegisterServiceProviderInAppTest.php b/tests/PackageServiceProviderTests/InstallCommandTests/CopyAndRegisterServiceProviderInAppTest.php index 1e4ecef..ee6f305 100644 --- a/tests/PackageServiceProviderTests/InstallCommandTests/CopyAndRegisterServiceProviderInAppTest.php +++ b/tests/PackageServiceProviderTests/InstallCommandTests/CopyAndRegisterServiceProviderInAppTest.php @@ -1,9 +1,9 @@