Skip to content

Commit

Permalink
Merge pull request #14 from thunderer/introduce-infection
Browse files Browse the repository at this point in the history
Mutation testing with Infection
  • Loading branch information
thunderer authored Apr 19, 2020
2 parents ab1b98f + 844cc57 commit 50b6df8
Show file tree
Hide file tree
Showing 10 changed files with 49 additions and 16 deletions.
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -3,5 +3,6 @@
tmp-phpqa
coverage
coverage.xml
infection.log
composer.lock
vendor
2 changes: 2 additions & 0 deletions .travis.yml
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,8 @@ before_script:
script:
- vendor/bin/phpunit --coverage-text
- vendor/bin/psalm --threads=8 --no-cache
- vendor/bin/infection
- cat infection.log

matrix:
allow_failures:
Expand Down
33 changes: 19 additions & 14 deletions Makefile
Original file line number Diff line number Diff line change
@@ -1,27 +1,30 @@
composer-install:
PHP_VERSION=7.4 docker-compose run --rm composer composer install
PHP_VERSION=74 docker-compose run --rm composer composer install
composer-update:
PHP_VERSION=7.4 docker-compose run --rm composer composer update
PHP_VERSION=74 docker-compose run --rm composer composer update
composer-require:
PHP_VERSION=7.4 docker-compose run --rm composer composer require ${PACKAGE}
PHP_VERSION=74 docker-compose run --rm composer composer require ${PACKAGE}
composer-require-dev:
PHP_VERSION=7.4 docker-compose run --rm composer composer require --dev ${PACKAGE}
PHP_VERSION=74 docker-compose run --rm composer composer require --dev ${PACKAGE}

test: test-phpunit
test-phpunit:
PHP_VERSION=7.4 docker-compose run --rm php php -v
PHP_VERSION=7.4 docker-compose run --rm php php vendor/bin/phpunit --coverage-text
PHP_VERSION=7.4 docker-compose run --rm php php vendor/bin/psalm --no-cache
PHP_VERSION=74 docker-compose run --rm php php -v
PHP_VERSION=74 docker-compose run --rm php php vendor/bin/phpunit --coverage-text
make qa-psalm
make qa-infection
test-phpunit-local:
php -v
php vendor/bin/phpunit --coverage-text
php vendor/bin/psalm --no-cache
php vendor/bin/infection

travis:
PHP_VERSION=7.1.3 make travis-job
PHP_VERSION=7.2 make travis-job
PHP_VERSION=7.3 make travis-job
PHP_VERSION=7.4 make travis-job
PHP_VERSION=7.4 docker-compose run --rm composer composer config --unset platform
PHP_VERSION=71 make travis-job
PHP_VERSION=72 make travis-job
PHP_VERSION=73 make travis-job
PHP_VERSION=74 make travis-job
PHP_VERSION=74 docker-compose run --rm composer composer config --unset platform
travis-job:
docker-compose run --rm composer composer config platform.php ${PHP_VERSION}
docker-compose run --rm composer composer update -q
Expand All @@ -30,7 +33,9 @@ travis-job:
PHP_VERSION=${PHP_VERSION} docker-compose run --rm php php vendor/bin/psalm --no-cache

qa-psalm:
PHP_VERSION=7.4 docker-compose run --rm php php vendor/bin/psalm --no-cache
PHP_VERSION=74 docker-compose run --rm php php vendor/bin/psalm --no-cache
qa-infection:
PHP_VERSION=74 docker-compose run --rm php php vendor/bin/infection

run-php:
PHP_VERSION=7.4 docker-compose run --rm php php ${FILE}
PHP_VERSION=74 docker-compose run --rm php php ${FILE}
3 changes: 2 additions & 1 deletion composer.json
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,8 @@
"hirak/prestissimo": "^0.3.8",
"vimeo/psalm": "^3.10",
"doctrine/dbal": "^2.9",
"doctrine/orm": "^2.7"
"doctrine/orm": "^2.7",
"infection/infection": ">=0.13"
},
"autoload": {
"psr-4": {
Expand Down
2 changes: 1 addition & 1 deletion docker-compose.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ services:
working_dir: /app

php:
image: php:${PHP_VERSION}
build: docker/php${PHP_VERSION}-xdebug
volumes:
- .:/app
working_dir: /app
3 changes: 3 additions & 0 deletions docker/php71-xdebug/Dockerfile
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
FROM php:7.1.3

RUN pecl install xdebug && docker-php-ext-enable xdebug
3 changes: 3 additions & 0 deletions docker/php72-xdebug/Dockerfile
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
FROM php:7.2

RUN pecl install xdebug && docker-php-ext-enable xdebug
3 changes: 3 additions & 0 deletions docker/php73-xdebug/Dockerfile
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
FROM php:7.3

RUN pecl install xdebug && docker-php-ext-enable xdebug
3 changes: 3 additions & 0 deletions docker/php74-xdebug/Dockerfile
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
FROM php:7.4

RUN pecl install xdebug && docker-php-ext-enable xdebug
12 changes: 12 additions & 0 deletions infection.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
{
"source": {
"directories": ["src"]
},
"logs": {
"text": "infection.log"
},
"timeout": 10,
"mutators": {
"@default": true
}
}

0 comments on commit 50b6df8

Please sign in to comment.