diff --git a/.github/workflows/mutation.yml b/.github/workflows/mutation.yml new file mode 100644 index 0000000..9c6f1ec --- /dev/null +++ b/.github/workflows/mutation.yml @@ -0,0 +1,26 @@ +on: + pull_request: + paths-ignore: + - 'docs/**' + - 'README.md' + - 'CHANGELOG.md' + - '.gitignore' + - '.gitattributes' + + push: + paths-ignore: + - 'docs/**' + - 'README.md' + - 'CHANGELOG.md' + - '.gitignore' + - '.gitattributes' + +name: mutation test + +jobs: + mutation: + uses: php-forge/actions/.github/workflows/infection.yml@main + with: + phpstan: true + secrets: + STRYKER_DASHBOARD_API_KEY: ${{ secrets.STRYKER_DASHBOARD_API_KEY }} diff --git a/composer.json b/composer.json index 826163d..35d3f24 100644 --- a/composer.json +++ b/composer.json @@ -15,6 +15,7 @@ }, "require-dev": { "ext-simplexml": "*", + "infection/infection": "^0.27|^0.29", "maglnet/composer-require-checker": "^4.1", "phpstan/extension-installer": "^1.4", "phpstan/phpstan-strict-rules": "^2.0.3", @@ -41,6 +42,7 @@ "config": { "sort-packages": true, "allow-plugins": { + "infection/extension-installer": true, "phpstan/extension-installer": true, "yiisoft/yii2-composer": true } @@ -48,6 +50,7 @@ "scripts": { "check-dependencies": "./vendor/bin/composer-require-checker check", "ecs": "./vendor/bin/ecs --fix", + "mutation": "./vendor/bin/infection --threads=4 --ignore-msi-with-no-mutations --only-covered --min-msi=100 --min-covered-msi=100", "rector": "./vendor/bin/rector process src", "static": "./vendor/bin/phpstan --memory-limit=512M", "tests": "./vendor/bin/phpunit" diff --git a/infection.json.dist b/infection.json5 similarity index 62% rename from infection.json.dist rename to infection.json5 index d06b334..15361d9 100644 --- a/infection.json.dist +++ b/infection.json5 @@ -1,16 +1,17 @@ { - "source": { - "directories": [ - "src" - ] - }, + "$schema": "vendor/infection/infection/resources/schema.json", "logs": { "text": "php:\/\/stderr", "stryker": { "report": "main" } }, - "mutators": { - "@default": true - } + "source": { + "directories": [ + "src" + ] + }, + "phpStan": { + "configDir": "." + }, } diff --git a/phpunit.xml.dist b/phpunit.xml.dist index 3ddadb0..2215bca 100644 --- a/phpunit.xml.dist +++ b/phpunit.xml.dist @@ -1,7 +1,7 @@ shiftLeftRightAttribute($value, $delta); - if ($leftValue >= $value) { + if ($leftValue > $value) { $leftValue += $delta; $rightValue += $delta; }