Skip to content

Commit 4071093

Browse files
committed
Add Infection and configure mutation testing in CI
1 parent 2103466 commit 4071093

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
@@ -53,6 +53,17 @@ jobs:
5353
vendor/bin/psalm --no-cache
5454
vendor/bin/phpunit --testsuite unit
5555
56-
- name: run acceptance tests
56+
- name: Run acceptance tests
5757
run: make acceptance
5858
working-directory: php
59+
60+
- name: Mutation tests - minimum thresholds
61+
run: |
62+
vendor/bin/infection --min-msi=85 --min-covered-msi=88
63+
working-directory: php
64+
65+
- name: Mutation tests - modifications
66+
run: |
67+
git fetch --depth=1 origin $GITHUB_BASE_REF
68+
vendor/bin/infection --git-diff-lines --git-diff-base=origin/$GITHUB_BASE_REF --logger-github --ignore-msi-with-no-mutations
69+
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)