From 17157da2bdc27e32d9321e01599b4c49cf08e1b1 Mon Sep 17 00:00:00 2001 From: Claude Date: Tue, 24 Mar 2026 13:49:27 +0000 Subject: [PATCH] test: add mutation testing with Infection PHP - Add infection/infection ^0.29 to require-dev - Create infection.json5 with sensible defaults matching phpstan source dirs - Add composer mutate script for running mutation tests - Add infection/extension-installer to allowed plugins - Update .gitignore for infection output files Fixes #34 Co-Authored-By: Claude Opus 4.6 (1M context) --- .gitignore | 3 +++ composer.json | 3 +++ infection.json5 | 44 ++++++++++++++++++++++++++++++++++++++++++++ 3 files changed, 50 insertions(+) create mode 100644 infection.json5 diff --git a/.gitignore b/.gitignore index d16642b..4dcb0d7 100644 --- a/.gitignore +++ b/.gitignore @@ -1,5 +1,8 @@ .DS_Store +/.infection /.phpunit.cache +infection.log +infection-summary.log /node_modules /public/build /public/hot diff --git a/composer.json b/composer.json index 1d3acfb..4594db0 100644 --- a/composer.json +++ b/composer.json @@ -12,6 +12,7 @@ "lthn/php": "*" }, "require-dev": { + "infection/infection": "^0.29", "larastan/larastan": "^3.0", "laravel/pint": "^1.18", "orchestra/testbench": "^9.0|^10.0", @@ -38,11 +39,13 @@ "scripts": { "analyse": "phpstan analyse", "lint": "pint", + "mutate": "infection --show-mutations --threads=max", "test": "pest" }, "config": { "sort-packages": true, "allow-plugins": { + "infection/extension-installer": true, "pestphp/pest-plugin": true } }, diff --git a/infection.json5 b/infection.json5 new file mode 100644 index 0000000..50b6df6 --- /dev/null +++ b/infection.json5 @@ -0,0 +1,44 @@ +{ + "$schema": "https://raw.githubusercontent.com/infection/infection/0.29.x/resources/schema.json", + "source": { + "directories": [ + "Concerns", + "Console", + "Contracts", + "Controllers", + "Database", + "Enums", + "Events", + "Exceptions", + "Features", + "Jobs", + "Listeners", + "Mail", + "Middleware", + "Models", + "Notifications", + "Routes", + "Rules", + "Scopes", + "Services", + "View" + ], + "excludes": [ + "Database/Factories", + "Database/Seeders" + ] + }, + "logs": { + "text": "infection.log", + "summary": "infection-summary.log" + }, + "mutators": { + "@default": true + }, + "testFramework": "pest", + "testFrameworkOptions": "--no-coverage", + "minMsi": 50, + "minCoveredMsi": 70, + "timeout": 30, + "tmpDir": ".infection" +}