Skip to content

Commit 5091e41

Browse files
authored
Mutation tests (#207)
* Added infection mutation tests * Moved min MSI setting to infection.json file
1 parent 17570c4 commit 5091e41

File tree

5 files changed

+84
-1
lines changed

5 files changed

+84
-1
lines changed

.github/workflows/mutation.yml

Lines changed: 59 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,59 @@
1+
name: "Mutation Tests"
2+
3+
on:
4+
pull_request:
5+
push:
6+
branches:
7+
- "1.x"
8+
schedule:
9+
- cron: '* 8 * * *'
10+
11+
jobs:
12+
compatibility:
13+
name: "Mutation Tests"
14+
15+
runs-on: ${{ matrix.operating-system }}
16+
17+
strategy:
18+
matrix:
19+
dependencies:
20+
- "locked"
21+
php-version:
22+
- "7.4"
23+
operating-system:
24+
- "ubuntu-latest"
25+
26+
steps:
27+
- name: "Checkout"
28+
uses: "actions/checkout@v2"
29+
30+
- name: "Install PHP"
31+
uses: "shivammathur/setup-php@v2"
32+
with:
33+
coverage: "pcov"
34+
php-version: "${{ matrix.php-version }}"
35+
ini-values: memory_limit=-1
36+
37+
- name: "Cache dependencies"
38+
uses: "actions/cache@v2"
39+
with:
40+
path: |
41+
~/.composer/cache
42+
vendor
43+
key: "php-${{ matrix.php-version }}-${{ matrix.dependencies }}"
44+
restore-keys: "php-${{ matrix.php-version }}-${{ matrix.dependencies }}"
45+
46+
- name: "Install lowest dependencies"
47+
if: ${{ matrix.dependencies == 'lowest' }}
48+
run: "composer update --prefer-lowest --no-interaction --no-progress --no-suggest"
49+
50+
- name: "Install highest dependencies"
51+
if: ${{ matrix.dependencies == 'highest' }}
52+
run: "composer update --no-interaction --no-progress --no-suggest"
53+
54+
- name: "Install locked dependencies"
55+
if: ${{ matrix.dependencies == 'locked' }}
56+
run: "composer install --no-interaction --no-progress --no-suggest"
57+
58+
- name: "Mutation Tests"
59+
run: "composer test:mutation"

.phive/phars.xml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4,4 +4,5 @@
44
<phar name="phpstan" version="^0.12.32" installed="0.12.32" location="./tools/phpstan" copy="true"/>
55
<phar name="roave/backwardcompatibilitycheck" version="^5.0.0" installed="5.0.0" location="./tools/roave-backward-compatibility-check" copy="true"/>
66
<phar name="psalm" version="^3.12.2" installed="3.12.2" location="./tools/psalm" copy="true"/>
7+
<phar name="infection" version="^0.16.4" installed="0.16.4" location="./tools/infection" copy="true"/>
78
</phive>

composer.json

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -51,6 +51,9 @@
5151
"test" : [
5252
"phpunit"
5353
],
54+
"test:mutation": [
55+
"tools/infection"
56+
],
5457
"static:analyze": [
5558
"tools/psalm --shepherd --stats",
5659
"tools/phpstan analyze -c phpstan.neon",

infection.json

Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,20 @@
1+
{
2+
"timeout": 5,
3+
"source": {
4+
"directories": [
5+
"src"
6+
]
7+
},
8+
"logs": {
9+
"text": "var/logs/infection.log",
10+
"summary": "var/logs/infection_summary.log",
11+
"debug": "var/logs/infection_summary.log"
12+
},
13+
"minMsi": 65,
14+
"minCoveredMsi": 70,
15+
"mutators": {
16+
"@default": true
17+
},
18+
"testFramework": "phpunit",
19+
"bootstrap": "./vendor/autoload.php"
20+
}

phpunit.xml.dist

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@
1010
<log type="coverage-html" target="var/phpunit/coverage/html" lowUpperBound="80" highLowerBound="100"/>
1111
</logging>
1212
<testsuites>
13-
<testsuite name="PHP Matcher Test Suite">
13+
<testsuite name="unit">
1414
<directory>./tests/</directory>
1515
</testsuite>
1616
</testsuites>

0 commit comments

Comments
 (0)