Skip to content

Commit c192b78

Browse files
committed
Add Infection and configure mutation testing in CI
1 parent 0fe269c commit c192b78

File tree

3 files changed

+31
-3
lines changed

3 files changed

+31
-3
lines changed

.github/workflows/test-php.yml

Lines changed: 12 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -58,6 +58,17 @@ jobs:
5858
vendor/bin/psalm --no-cache
5959
vendor/bin/phpunit --testsuite unit
6060
61-
- name: run acceptance tests
61+
- name: Run acceptance tests
6262
run: make acceptance
6363
working-directory: php
64+
65+
- name: Mutation tests - minimum thresholds
66+
run: |
67+
vendor/bin/infection --min-msi=85 --min-covered-msi=88
68+
working-directory: php
69+
70+
- name: Mutation tests - modifications
71+
run: |
72+
git fetch --depth=1 origin $GITHUB_BASE_REF
73+
vendor/bin/infection --git-diff-lines --git-diff-base=origin/$GITHUB_BASE_REF --logger-github --ignore-msi-with-no-mutations
74+
working-directory: php

php/composer.json

Lines changed: 8 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,8 @@
2222
"vimeo/psalm": "^4.24",
2323
"friendsofphp/php-cs-fixer": "^3.5",
2424
"psalm/plugin-phpunit": "^0.18.0",
25-
"nikic/php-parser": "^4.14"
25+
"nikic/php-parser": "^4.14",
26+
"infection/infection": "^0.26.16"
2627
},
2728
"repositories": [
2829
{
@@ -34,5 +35,10 @@
3435
}
3536
}
3637
}
37-
]
38+
],
39+
"config": {
40+
"allow-plugins": {
41+
"infection/extension-installer": false
42+
}
43+
}
3844
}

php/infection.json5

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,11 @@
1+
{
2+
"$schema": "vendor/infection/infection/resources/schema.json",
3+
"source": {
4+
"directories": [
5+
"src",
6+
]
7+
},
8+
"mutators": {
9+
"@default": true
10+
}
11+
}

0 commit comments

Comments
 (0)