From efe324c08bd3d2698c2ffe372d7c859ba3e4f4b1 Mon Sep 17 00:00:00 2001 From: Aidan Woods Date: Sat, 2 Feb 2019 21:09:56 +0000 Subject: [PATCH] Add mutation testing --- .gitignore | 1 + .travis.yml | 67 +++++++++++++++++++++++++++++---------------- composer.json | 3 +- infection.json.dist | 14 ++++++++++ 4 files changed, 61 insertions(+), 24 deletions(-) create mode 100644 infection.json.dist diff --git a/.gitignore b/.gitignore index d8a7996..725b855 100644 --- a/.gitignore +++ b/.gitignore @@ -1,2 +1,3 @@ composer.lock vendor/ +infection.log diff --git a/.travis.yml b/.travis.yml index 57ce447..7229ca2 100644 --- a/.travis.yml +++ b/.travis.yml @@ -5,31 +5,15 @@ sudo: false stages: - Code Format and Static Analysis - - test + - Units + - Mutation - Test CommonMark (weak) -php: - - 5.5 - - 5.6 - - 7.0 - - 7.1 - - 7.2 - - 7.3 - - nightly - matrix: fast_finish: true allow_failures: - - php: nightly - env: ALLOW_FAILURE -install: - # remove packages with PHP requirements higher than 7.0 to prevent composer trying to resolve these, see: https://github.com/composer/composer/issues/6011 - - composer remove vimeo/psalm friendsofphp/php-cs-fixer --dev --no-update --no-interaction - - composer install --prefer-dist --no-interaction --no-progress - -script: composer test-units - cache: directories: - $HOME/.composer/cache @@ -45,7 +29,47 @@ jobs: - composer test-formatting - composer test-dead-code - - stage: Test CommonMark + + - &UNIT_TEST + stage: Units + php: 5.5 + install: + # remove packages with PHP requirements higher than 7.0 to prevent composer trying to resolve these, see: https://github.com/composer/composer/issues/6011 + - composer remove vimeo/psalm friendsofphp/php-cs-fixer infection/infection --dev --no-update --no-interaction + - composer install --prefer-dist --no-interaction --no-progress + script: composer test-units + - <<: *UNIT_TEST + php: 5.6 + - <<: *UNIT_TEST + php: 7.0 + - <<: *UNIT_TEST + php: 7.1 + - <<: *UNIT_TEST + php: 7.2 + - <<: *UNIT_TEST + php: 7.3 + - <<: *UNIT_TEST + php: nightly + env: ALLOW_FAILURE + + + - &MUTATION_TEST + stage: Mutation + php: 7.1 + install: + - composer install --prefer-dist --no-interaction --no-progress + script: vendor/bin/infection --threads=2 --min-msi=80 --min-covered-msi=80 + - <<: *MUTATION_TEST + php: 7.2 + - <<: *MUTATION_TEST + php: 7.3 + - <<: *MUTATION_TEST + php: nightly + env: ALLOW_FAILURE + + + - &COMMONMARK_TEST + stage: CommonMark name: Weak php: 7.3 env: ALLOW_FAILURE @@ -53,10 +77,7 @@ jobs: script: - composer test-commonmark-weak - - stage: Test CommonMark + - <<: *COMMONMARK_TEST name: Strict - php: 7.3 - env: ALLOW_FAILURE - install: composer install --prefer-dist --no-interaction --no-progress script: - composer test-commonmark diff --git a/composer.json b/composer.json index 5a85e44..ead5c5e 100644 --- a/composer.json +++ b/composer.json @@ -19,7 +19,8 @@ "require-dev": { "phpunit/phpunit": "^7.4|^6.5.13|^5.7.27|^4.8.36", "vimeo/psalm": "^3.0.11", - "friendsofphp/php-cs-fixer": "^2.13" + "friendsofphp/php-cs-fixer": "^2.13", + "infection/infection": "^0.12.0" }, "autoload": { "psr-4": {"Erusev\\Parsedown\\": "src/"} diff --git a/infection.json.dist b/infection.json.dist new file mode 100644 index 0000000..57d6912 --- /dev/null +++ b/infection.json.dist @@ -0,0 +1,14 @@ +{ + "timeout": 10, + "source": { + "directories": [ + "src" + ] + }, + "logs": { + "text": "infection.log" + }, + "mutators": { + "@default": true + } +}