Skip to content

Commit

Permalink
Add Infection and configure mutation testing in CI
Browse files Browse the repository at this point in the history
  • Loading branch information
ciaranmcnulty committed Nov 13, 2022
1 parent c85ba5c commit 71cc900
Show file tree
Hide file tree
Showing 3 changed files with 31 additions and 3 deletions.
13 changes: 12 additions & 1 deletion .github/workflows/test-php.yml
Original file line number Diff line number Diff line change
Expand Up @@ -58,6 +58,17 @@ jobs:
vendor/bin/psalm --no-cache
vendor/bin/phpunit --testsuite unit
- name: run acceptance tests
- name: Run acceptance tests
run: make acceptance
working-directory: php

- name: Mutation tests - minimum thresholds
run: |
vendor/bin/infection --min-msi=85 --min-covered-msi=88
working-directory: php

- name: Mutation tests - modifications
run: |
git fetch --depth=1 origin $GITHUB_BASE_REF
vendor/bin/infection --git-diff-lines --git-diff-base=origin/$GITHUB_BASE_REF --logger-github --ignore-msi-with-no-mutations
working-directory: php
10 changes: 8 additions & 2 deletions php/composer.json
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,8 @@
"vimeo/psalm": "^4.24",
"friendsofphp/php-cs-fixer": "^3.5",
"psalm/plugin-phpunit": "^0.18.0",
"nikic/php-parser": "^4.14"
"nikic/php-parser": "^4.14",
"infection/infection": "^0.26.16"
},
"repositories": [
{
Expand All @@ -34,5 +35,10 @@
}
}
}
]
],
"config": {
"allow-plugins": {
"infection/extension-installer": false
}
}
}
11 changes: 11 additions & 0 deletions php/infection.json5
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
{
"$schema": "vendor/infection/infection/resources/schema.json",
"source": {
"directories": [
"src",
]
},
"mutators": {
"@default": true
}
}

0 comments on commit 71cc900

Please sign in to comment.