From 03f689812f816f62c32083f406b57e81282e8759 Mon Sep 17 00:00:00 2001 From: yoeriwalstra Date: Thu, 7 May 2026 13:32:00 +0200 Subject: [PATCH 01/11] :memo: add license --- LICENSE.txt | 21 +++++++++++++++++++++ 1 file changed, 21 insertions(+) create mode 100644 LICENSE.txt diff --git a/LICENSE.txt b/LICENSE.txt new file mode 100644 index 0000000..89ac437 --- /dev/null +++ b/LICENSE.txt @@ -0,0 +1,21 @@ +MIT License + +Copyright (c) 2026-present Yoeri Walstra & collaborators + +Permission is hereby granted, free of charge, to any person obtaining a copy +of this software and associated documentation files (the "Software"), to deal +in the Software without restriction, including without limitation the rights +to use, copy, modify, merge, publish, distribute, sublicense, and/or sell +copies of the Software, and to permit persons to whom the Software is +furnished to do so, subject to the following conditions: + +The above copyright notice and this permission notice shall be included in all +copies or substantial portions of the Software. + +THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, +OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE +SOFTWARE. From c58ad8b4c57f41c303cd9c1e1f9ad47ca44408e3 Mon Sep 17 00:00:00 2001 From: yoeriwalstra Date: Thu, 7 May 2026 13:39:27 +0200 Subject: [PATCH 02/11] point tests workflow to master branch --- .github/workflows/tests.yml | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/.github/workflows/tests.yml b/.github/workflows/tests.yml index a91bb2e..52ce311 100644 --- a/.github/workflows/tests.yml +++ b/.github/workflows/tests.yml @@ -2,9 +2,9 @@ name: Tests on: push: - branches: [main] + branches: [master] pull_request: - branches: [main] + branches: [master] jobs: test: From e5014f262cee143ea03f37ed81ed408fe8aeb01d Mon Sep 17 00:00:00 2001 From: yoeriwalstra Date: Thu, 7 May 2026 13:48:23 +0200 Subject: [PATCH 03/11] include laravel 8 in tests workflow --- .github/workflows/tests.yml | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/.github/workflows/tests.yml b/.github/workflows/tests.yml index 52ce311..775e2b4 100644 --- a/.github/workflows/tests.yml +++ b/.github/workflows/tests.yml @@ -2,9 +2,9 @@ name: Tests on: push: - branches: [master] + branches: [ master ] pull_request: - branches: [master] + branches: [ master ] jobs: test: @@ -14,14 +14,14 @@ jobs: strategy: fail-fast: false matrix: - php: ["8.2", "8.3"] - laravel: ["9.*", "10.*", "11.*", "12.*"] + php: [ "8.2", "8.3" ] + laravel: [ "8.*", "9.*", "10.*", "11.*", "12.*" ] exclude: # Laravel 11+ requires PHP 8.2+, already satisfied here. # Laravel 9 and 10 are compatible with PHP 8.2 and 8.3. # No exclusions needed, but keep this block for clarity. - php: "8.2" - laravel: "9.*" # Laravel 9 supports PHP 8.0+, valid combo + laravel: "8.*" steps: - name: Checkout From d6b57f7815cbb5732762a42119f375ee857eeb54 Mon Sep 17 00:00:00 2001 From: yoeriwalstra Date: Thu, 7 May 2026 14:01:56 +0200 Subject: [PATCH 04/11] more permissive PHP version and dependencies for lower Laravel framework versions --- .github/workflows/tests.yml | 40 ++++++++++++++++++++++++++++++------- composer.json | 10 +++++----- 2 files changed, 38 insertions(+), 12 deletions(-) diff --git a/.github/workflows/tests.yml b/.github/workflows/tests.yml index 775e2b4..96152e6 100644 --- a/.github/workflows/tests.yml +++ b/.github/workflows/tests.yml @@ -14,14 +14,39 @@ jobs: strategy: fail-fast: false matrix: - php: [ "8.2", "8.3" ] - laravel: [ "8.*", "9.*", "10.*", "11.*", "12.*" ] - exclude: - # Laravel 11+ requires PHP 8.2+, already satisfied here. - # Laravel 9 and 10 are compatible with PHP 8.2 and 8.3. - # No exclusions needed, but keep this block for clarity. - - php: "8.2" + include: + # Laravel 8 — testbench ^6.0 supports PHP 7.3–8.1 + - php: "8.1" laravel: "8.*" + testbench: "^6.0" + # Laravel 9 — testbench ^7.0 supports PHP 8.0–8.1 + - php: "8.1" + laravel: "9.*" + testbench: "^7.0" + # Laravel 10 — testbench ^8.0 supports PHP 8.1–8.3 + - php: "8.1" + laravel: "10.*" + testbench: "^8.0" + - php: "8.2" + laravel: "10.*" + testbench: "^8.0" + - php: "8.3" + laravel: "10.*" + testbench: "^8.0" + # Laravel 11 — testbench ^9.0 supports PHP 8.2–8.3 + - php: "8.2" + laravel: "11.*" + testbench: "^9.0" + - php: "8.3" + laravel: "11.*" + testbench: "^9.0" + # Laravel 12 — testbench ^10.0 supports PHP 8.2–8.3 + - php: "8.2" + laravel: "12.*" + testbench: "^10.0" + - php: "8.3" + laravel: "12.*" + testbench: "^10.0" steps: - name: Checkout @@ -39,6 +64,7 @@ jobs: composer require "illuminate/support:${{ matrix.laravel }}" \ "illuminate/database:${{ matrix.laravel }}" \ "illuminate/console:${{ matrix.laravel }}" \ + "orchestra/testbench:${{ matrix.testbench }}" \ --no-update composer update --prefer-stable --prefer-dist --no-interaction diff --git a/composer.json b/composer.json index 20a346e..63b8198 100644 --- a/composer.json +++ b/composer.json @@ -10,13 +10,13 @@ } ], "require": { - "php": "^8.2", - "illuminate/console": "^9.0|^10.0|^11.0|^12.0", - "illuminate/database": "^9.0|^10.0|^11.0|^12.0", - "illuminate/support": "^9.0|^10.0|^11.0|^12.0" + "php": "^8.1", + "illuminate/console": "^8.0|^9.0|^10.0|^11.0|^12.0", + "illuminate/database": "^8.0|^9.0|^10.0|^11.0|^12.0", + "illuminate/support": "^8.0|^9.0|^10.0|^11.0|^12.0" }, "require-dev": { - "orchestra/testbench": "^7.0|^8.0|^9.0|^10.0", + "orchestra/testbench": "^6.0|^7.0|^8.0|^9.0|^10.0", "phpunit/phpunit": "^9.0|^10.0|^11.0" }, "autoload": { From 39a0a58e725084429173676990cc58382ab833c8 Mon Sep 17 00:00:00 2001 From: yoeriwalstra Date: Thu, 7 May 2026 14:06:49 +0200 Subject: [PATCH 05/11] add --no-audit and --no-blocking flags to composer update for tests to ignore security advisory blockades --- .github/workflows/tests.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/tests.yml b/.github/workflows/tests.yml index 96152e6..4e9066b 100644 --- a/.github/workflows/tests.yml +++ b/.github/workflows/tests.yml @@ -67,7 +67,7 @@ jobs: "orchestra/testbench:${{ matrix.testbench }}" \ --no-update - composer update --prefer-stable --prefer-dist --no-interaction + composer update --prefer-stable --prefer-dist --no-interaction --no-audit --no-blocking - name: Run tests run: vendor/bin/phpunit From c28db5e18be927bce69b16b9a5dc915cf7833f06 Mon Sep 17 00:00:00 2001 From: yoeriwalstra Date: Thu, 7 May 2026 14:17:05 +0200 Subject: [PATCH 06/11] use composer:latest image tag --- Dockerfile | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Dockerfile b/Dockerfile index 0de6e73..5dc4059 100644 --- a/Dockerfile +++ b/Dockerfile @@ -10,7 +10,7 @@ RUN apk add --no-cache \ && docker-php-ext-install pdo pdo_sqlite # Install Composer -COPY --from=composer:2 /usr/bin/composer /usr/bin/composer +COPY --from=composer:latest /usr/bin/composer /usr/bin/composer RUN git config --global --add safe.directory "/app" From 38bf4027a17a4f847cff9c40ddb8ab38ad6ad47c Mon Sep 17 00:00:00 2001 From: yoeriwalstra Date: Thu, 7 May 2026 14:21:54 +0200 Subject: [PATCH 07/11] set composer config to not block insecure dependencies in pipeline --- .github/workflows/tests.yml | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/.github/workflows/tests.yml b/.github/workflows/tests.yml index 4e9066b..f2acde4 100644 --- a/.github/workflows/tests.yml +++ b/.github/workflows/tests.yml @@ -67,7 +67,8 @@ jobs: "orchestra/testbench:${{ matrix.testbench }}" \ --no-update - composer update --prefer-stable --prefer-dist --no-interaction --no-audit --no-blocking + composer config audit.block-insecure false + composer update --prefer-stable --prefer-dist --no-interaction - name: Run tests run: vendor/bin/phpunit From 29666c72c4c21c840fbce21ee75a45b00e25dfa1 Mon Sep 17 00:00:00 2001 From: yoeriwalstra Date: Thu, 7 May 2026 14:37:19 +0200 Subject: [PATCH 08/11] set docker image composer:2 version tag --- Dockerfile | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Dockerfile b/Dockerfile index 5dc4059..0de6e73 100644 --- a/Dockerfile +++ b/Dockerfile @@ -10,7 +10,7 @@ RUN apk add --no-cache \ && docker-php-ext-install pdo pdo_sqlite # Install Composer -COPY --from=composer:latest /usr/bin/composer /usr/bin/composer +COPY --from=composer:2 /usr/bin/composer /usr/bin/composer RUN git config --global --add safe.directory "/app" From 2355c85970289c5952ff82a882ce1c771f502b18 Mon Sep 17 00:00:00 2001 From: yoeriwalstra Date: Thu, 7 May 2026 14:37:30 +0200 Subject: [PATCH 09/11] make tests compatible with Laravel 8 --- src/Console/Commands/ResourceCleanupCommand.php | 4 ++-- tests/Feature/ResourceCleanupCommandTest.php | 11 ++++++----- 2 files changed, 8 insertions(+), 7 deletions(-) diff --git a/src/Console/Commands/ResourceCleanupCommand.php b/src/Console/Commands/ResourceCleanupCommand.php index 3be2c66..7015036 100644 --- a/src/Console/Commands/ResourceCleanupCommand.php +++ b/src/Console/Commands/ResourceCleanupCommand.php @@ -46,7 +46,7 @@ public function handle(): int if ($this->option('dry-run')) { $count = $query->count(); - $this->line(sprintf(' [dry-run] %s: %d record(s) would be deleted.', $modelClass, $count)); + $this->line(sprintf('[dry-run] %s: %d record(s) would be deleted.', $modelClass, $count)); $totalDeleted += $count; @@ -61,7 +61,7 @@ public function handle(): int } }); - $this->line(sprintf(' %s: %d record(s) deleted.', $modelClass, $deleted)); + $this->line(sprintf('%s: %d record(s) deleted.', $modelClass, $deleted)); $totalDeleted += $deleted; } diff --git a/tests/Feature/ResourceCleanupCommandTest.php b/tests/Feature/ResourceCleanupCommandTest.php index 9807be3..af718e3 100644 --- a/tests/Feature/ResourceCleanupCommandTest.php +++ b/tests/Feature/ResourceCleanupCommandTest.php @@ -22,7 +22,7 @@ public function test_dry_run(): void TestResource::create(['name' => 'recent']); $this->artisan('resource-cleanup:run --dry-run') - ->expectsOutputToContain('3 record(s) would be deleted') + ->expectsOutput('[dry-run] ' . TestResource::class . ': 3 record(s) would be deleted.') ->assertSuccessful(); // No records should have been deleted @@ -40,7 +40,8 @@ public function test_resource_cleanup_all_configured_models(): void TestResource::create(['name' => 'recent']); $this->artisan('resource-cleanup:run') - ->expectsOutputToContain('3 record(s) deleted') + ->expectsOutput(TestResource::class . ': 3 record(s) deleted.') + ->expectsOutput('Done. Total: 3 record(s) deleted.') ->assertSuccessful(); $this->assertSame(0, TestResource::withTrashed()->where('name', 'like', 'old-%')->count()); @@ -58,7 +59,7 @@ public function test_resource_cleanup_valid_model_options(): void TestResource::create(['name' => 'old', 'created_at' => $old])->delete(); $this->artisan('resource-cleanup:run', ['--model' => [TestResource::class]]) - ->expectsOutputToContain(TestResource::class) + ->expectsOutput(TestResource::class . ': 1 record(s) deleted.') ->assertSuccessful(); } @@ -105,7 +106,7 @@ public function test_resource_cleanup_fails_without_configured_models(): void $this->app['config']->set('resource-cleanup.models', []); $this->artisan('resource-cleanup:run') - ->expectsOutputToContain('No cleanable models defined') + ->expectsOutput('No cleanable models defined. Add class-strings to resource-cleanup.models in your config, e.g. App\\Models\\YourModel.') ->assertFailed(); } @@ -114,7 +115,7 @@ public function test_resource_cleanup_fails_with_invalid_model_options(): void $this->app['config']->set('resource-cleanup.models', [TestResource::class]); $this->artisan('resource-cleanup:run', ['--model' => ['App\\Models\\NonExistent']]) - ->expectsOutputToContain('Invalid model options specified') + ->expectsOutput("Invalid model options specified. Valid models are: \n" . TestResource::class) ->assertFailed(); } } From ab4c88617bab52a55567df4f89107f1e5bd36366 Mon Sep 17 00:00:00 2001 From: yoeri walstra <48599583+yoerriwalstra@users.noreply.github.com> Date: Thu, 7 May 2026 14:57:39 +0200 Subject: [PATCH 10/11] Update .github/workflows/tests.yml to cancels already running actions Co-authored-by: zwaans <83594488+zwaans@users.noreply.github.com> --- .github/workflows/tests.yml | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/.github/workflows/tests.yml b/.github/workflows/tests.yml index f2acde4..0133fc4 100644 --- a/.github/workflows/tests.yml +++ b/.github/workflows/tests.yml @@ -6,6 +6,10 @@ on: pull_request: branches: [ master ] +concurrency: + group: ${{ github.workflow }}-${{ github.event.pull_request.number || github.ref }} + cancel-in-progress: true + jobs: test: name: PHP ${{ matrix.php }} / Laravel ${{ matrix.laravel }} From 14f7cd5042947fb7f5f2bed1fc7e0f22a2075937 Mon Sep 17 00:00:00 2001 From: yoeriwalstra Date: Fri, 8 May 2026 16:49:59 +0200 Subject: [PATCH 11/11] allow installing insecure composer dependencies conditionally --- .github/workflows/tests.yml | 16 ++++++++++++++-- 1 file changed, 14 insertions(+), 2 deletions(-) diff --git a/.github/workflows/tests.yml b/.github/workflows/tests.yml index 0133fc4..223058a 100644 --- a/.github/workflows/tests.yml +++ b/.github/workflows/tests.yml @@ -9,7 +9,7 @@ on: concurrency: group: ${{ github.workflow }}-${{ github.event.pull_request.number || github.ref }} cancel-in-progress: true - + jobs: test: name: PHP ${{ matrix.php }} / Laravel ${{ matrix.laravel }} @@ -23,34 +23,43 @@ jobs: - php: "8.1" laravel: "8.*" testbench: "^6.0" + allow_insecure: true # Laravel 9 — testbench ^7.0 supports PHP 8.0–8.1 - php: "8.1" laravel: "9.*" testbench: "^7.0" + allow_insecure: true # Laravel 10 — testbench ^8.0 supports PHP 8.1–8.3 - php: "8.1" laravel: "10.*" testbench: "^8.0" + allow_insecure: false - php: "8.2" laravel: "10.*" testbench: "^8.0" + allow_insecure: false - php: "8.3" laravel: "10.*" testbench: "^8.0" + allow_insecure: false # Laravel 11 — testbench ^9.0 supports PHP 8.2–8.3 - php: "8.2" laravel: "11.*" testbench: "^9.0" + allow_insecure: false - php: "8.3" laravel: "11.*" testbench: "^9.0" + allow_insecure: false # Laravel 12 — testbench ^10.0 supports PHP 8.2–8.3 - php: "8.2" laravel: "12.*" testbench: "^10.0" + allow_insecure: false - php: "8.3" laravel: "12.*" testbench: "^10.0" + allow_insecure: false steps: - name: Checkout @@ -63,6 +72,10 @@ jobs: extensions: mbstring, pdo, pdo_sqlite, sqlite3 coverage: none + - name: Allow insecure packages + if: ${{ matrix.allow_insecure == true }} + run: composer config audit.block-insecure false + - name: Install dependencies run: | composer require "illuminate/support:${{ matrix.laravel }}" \ @@ -71,7 +84,6 @@ jobs: "orchestra/testbench:${{ matrix.testbench }}" \ --no-update - composer config audit.block-insecure false composer update --prefer-stable --prefer-dist --no-interaction - name: Run tests