Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add mutation testing #510

Merged
merged 4 commits into from
Sep 8, 2020
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
1 change: 1 addition & 0 deletions .gitattributes
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@
/composer-require-checker.json export-ignore
/box.json.dist export-ignore
/Makefile export-ignore
/infection.json.dist export-ignore
/phpcs.xml.dist export-ignore
/phpstan.neon.dist export-ignore
/phpunit.xml.dist export-ignore
Expand Down
20 changes: 16 additions & 4 deletions .github/workflows/integrate.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -152,8 +152,8 @@ jobs:
run: "composer update --no-interaction --no-progress --ignore-platform-reqs"

- name: "Run tests"
timeout-minutes: 10
run: "vendor/bin/phpunit"
timeout-minutes: 3
run: "vendor/bin/phpunit --no-coverage --no-logging"

code-coverage:
name: "Code Coverage"
Expand All @@ -174,6 +174,7 @@ jobs:
with:
coverage: "pcov"
php-version: "${{ matrix.php-version }}"
ini-values: zend.assertions=1
tools: composer:v1

- name: "Get composer cache directory"
Expand All @@ -191,13 +192,24 @@ jobs:
run: "composer update --no-interaction --no-progress"

- name: "Run tests"
timeout-minutes: 10
run: "vendor/bin/phpunit --coverage-clover=coverage.xml"
timeout-minutes: 3
run: "vendor/bin/phpunit --coverage-clover=coverage.xml --coverage-xml=coverage/coverage-xml --log-junit=coverage/junit.xml"

- name: "Send code coverage report to Codecov.io"
uses: codecov/codecov-action@v1
with:
token: ${{ secrets.CODECOV_TOKEN }}
file: ./coverage.xml
fail_ci_if_error: true

- name: "Infection"
timeout-minutes: 10
run: "vendor/bin/infection --ansi --threads=$(nproc) --coverage=coverage --skip-initial-tests"
env:
INFECTION_BADGE_API_KEY: ${{ secrets.INFECTION_BADGE_API_KEY }}

- name: "Output infections"
run: "cat infections.log"

coding-standards:
name: "Coding Standards"
Expand Down
2 changes: 2 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -1,6 +1,8 @@
/.idea
/coverage
/test/fixtures/generated_tests
/vendor
composer.lock
.phpunit.result.cache
.php_cs.cache
infections.log
6 changes: 5 additions & 1 deletion Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -17,4 +17,8 @@ static-analysis: vendor

.PHONY: test
test: vendor
php -d zend.assertions=1 vendor/bin/phpunit ${arg}
php -d zend.assertions=1 vendor/bin/phpunit --coverage-xml=coverage/coverage-xml --log-junit=coverage/junit.xml

.PHONY: code-coverage
code-coverage: test
php -d zend.assertions=1 vendor/bin/infection --threads=$(shell nproc) --coverage=coverage --skip-initial-tests
1 change: 1 addition & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@ ParaTest
[![Integrate](https://github.com/paratestphp/paratest/workflows/Integrate/badge.svg?branch=master)](https://github.com/paratestphp/paratest/actions)
[![Code Coverage](https://codecov.io/gh/paratestphp/paratest/coverage.svg?branch=master)](https://codecov.io/gh/paratestphp/paratest?branch=master)
[![Type Coverage](https://shepherd.dev/github/paratestphp/paratest/coverage.svg)](https://shepherd.dev/github/paratestphp/paratest)
[![Infection MSI](https://badge.stryker-mutator.io/github.com/paratestphp/paratest/master)](https://dashboard.stryker-mutator.io/reports/github.com/paratestphp/paratest/master)

The objective of ParaTest is to support parallel testing in PHPUnit. Provided you have well-written PHPUnit tests, you can drop `paratest` in your project and
start using it with no additional bootstrap or configurations!
Expand Down
1 change: 1 addition & 0 deletions composer.json
Original file line number Diff line number Diff line change
Expand Up @@ -36,6 +36,7 @@
"doctrine/coding-standard": "^8.1.0",
"ekino/phpstan-banned-code": "^0.3.1",
"ergebnis/phpstan-rules": "^0.15.2",
"infection/infection": "^0.17.3",
"phpstan/phpstan": "^0.12.42",
"phpstan/phpstan-deprecation-rules": "^0.12.5",
"phpstan/phpstan-phpunit": "^0.12.16",
Expand Down
19 changes: 19 additions & 0 deletions infection.json.dist
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
{
"source": {
"directories": [
"src"
]
},
"timeout": 10,
"logs": {
"text": "infections.log",
"badge": {
"branch": "master"
}
},
"mutators": {
"@default": true
},
"minMsi": 82,
"minCoveredMsi": 84
}
3 changes: 3 additions & 0 deletions phpunit.xml.dist
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,9 @@
<include>
<directory suffix=".php">src</directory>
</include>
<report>
<text outputFile="php://stdout" showUncoveredFiles="false" showOnlySummary="true"/>
</report>
</coverage>
<testsuites>
<testsuite name="ParaTest Unit Tests">
Expand Down