test: add mutation testing with Infection PHP #75

Open
Charon wants to merge 2 commits from feat/add-infection-mutation-testing into dev
4 changed files with 85 additions and 0 deletions

3
.gitignore vendored
View file

@ -1,5 +1,8 @@
.DS_Store
/.infection
/.phpunit.cache
infection.log
infection-summary.log
/node_modules
/public/build
/public/hot

View file

@ -12,6 +12,8 @@
"lthn/php": "*"
},
"require-dev": {
"infection/infection": "^0.29",
"larastan/larastan": "^3.0",
"laravel/pint": "^1.18",
"orchestra/testbench": "^9.0|^10.0",
"pestphp/pest": "^3.0"
@ -35,12 +37,15 @@
}
},
"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
}
},

44
infection.json5 Normal file
View file

@ -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"
}

33
phpstan.neon Normal file
View file

@ -0,0 +1,33 @@
includes:
- vendor/larastan/larastan/extension.neon
parameters:
level: 5
paths:
- Boot.php
- Concerns
- Console
- Contracts
- Controllers
- Database
- Enums
- Events
- Exceptions
- Features
- Jobs
- Listeners
- Mail
- Middleware
- Models
- Notifications
- Routes
- Rules
- Scopes
- Services
- View
excludePaths:
- vendor
checkMissingIterableValueType: false