Skip to content

Commit 0a2097b

Browse files
authored
Add Infection (#172)
Run mutation testing with scoped Infection
1 parent b21fbfe commit 0a2097b

File tree

8 files changed

+885
-130
lines changed

8 files changed

+885
-130
lines changed

.travis.yml

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@ cache:
88

99
matrix:
1010
include:
11-
- php: '7.1'
11+
- php: '7.2'
1212
env: COVERAGE='true'
1313
- php: '7.1'
1414
- php: nightly
@@ -18,7 +18,6 @@ matrix:
1818

1919
before_install:
2020
- echo "memory_limit=-1" >> ~/.phpenv/versions/$(phpenv version-name)/etc/conf.d/travis.ini
21-
- phpenv config-rm xdebug.ini || true
2221
- |
2322
if [ 'false' == "$TRAVIS_PULL_REQUEST" ]; then
2423
cp box.json.dist box.json
@@ -35,7 +34,7 @@ script:
3534
make tc
3635
make e2e
3736
else
38-
make tu
37+
make tm
3938
fi
4039
4140
deploy:

Makefile

Lines changed: 18 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -57,8 +57,12 @@ tc: ## Run PHPUnit tests with test coverage
5757
tc: vendor/bin/phpunit
5858
phpdbg -qrr -d zend.enable_gc=0 $(PHPUNIT) --coverage-html=dist/coverage --coverage-text
5959

60+
tm: ## Run Infection (Mutation Testing)
61+
tm: vendor/bin/phpunit
62+
$(MAKE) e2e_020
63+
6064
e2e: ## Run end-to-end tests
61-
e2e: e2e_004 e2e_005 e2e_011 e2e_013 e2e_014 e2e_015 e2e_016 e2e_017 e2e_018 e2e_019
65+
e2e: e2e_004 e2e_005 e2e_011 e2e_013 e2e_014 e2e_015 e2e_016 e2e_017 e2e_018 e2e_019 e2e_020
6266

6367
e2e_004: ## Run end-to-end tests for the fixture set 004: source code case
6468
e2e_004: bin/php-scoper.phar
@@ -145,6 +149,13 @@ e2e_019: bin/php-scoper.phar fixtures/set019-symfony-console/vendor
145149
php build/set019-symfony-console/main.php > build/set019-symfony-console/output
146150
diff fixtures/set019-symfony-console/expected-output build/set019-symfony-console/output
147151

152+
e2e_020: ## Run end-to-end tests for the fixture set 020: Infection
153+
e2e_020: bin/php-scoper.phar fixtures/set020-infection/vendor
154+
php -d zend.enable_gc=0 $(PHPSCOPER) add-prefix --working-dir=fixtures/set020-infection --output-dir=../../build/set020-infection --force --no-interaction --stop-on-failure
155+
composer --working-dir=build/set020-infection dump-autoload
156+
157+
php build/set020-infection/vendor/infection/infection/bin/infection
158+
148159
tb: ## Run Blackfire profiling
149160
tb: vendor
150161
rm -rf build
@@ -195,6 +206,9 @@ fixtures/set018-nikic-parser/vendor: fixtures/set018-nikic-parser/composer.lock
195206
fixtures/set019-symfony-console/vendor: fixtures/set019-symfony-console/composer.lock
196207
composer --working-dir=fixtures/set019-symfony-console install
197208

209+
fixtures/set020-infection/vendor: fixtures/set020-infection/composer.lock
210+
composer --working-dir=fixtures/set020-infection install
211+
198212
composer.lock: composer.json
199213
@echo composer.lock is not up to date.
200214

@@ -222,6 +236,9 @@ fixtures/set018-nikic-parser/composer.lock: fixtures/set018-nikic-parser/compose
222236
fixtures/set019-symfony-console/composer.lock: fixtures/set019-symfony-console/composer.json
223237
@echo fixtures/set019-symfony-console/composer.lock is not up to date.
224238

239+
fixtures/set020-infection/composer.lock: fixtures/set020-infection/composer.json
240+
@echo fixtures/set020-infection/composer.lock is not up to date.
241+
225242
bin/php-scoper.phar: bin/php-scoper src vendor vendor-bin/box/vendor scoper.inc.php box.json
226243
$(MAKE) build
227244

fixtures/set018-nikic-parser/composer.lock

Lines changed: 0 additions & 120 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

fixtures/set018-nikic-parser/expected-output

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,9 @@
11
array(
2-
0: rser_Node_Stmt_Function(
2+
0: Stmt_Function(
33
byRef: false
44
name: test
55
params: array(
6-
0: rser_Node_Param(
6+
0: Param(
77
type: null
88
byRef: false
99
variadic: false
@@ -13,15 +13,15 @@ array(
1313
)
1414
returnType: null
1515
stmts: array(
16-
0: rser_Node_Expr_FuncCall(
17-
name: rser_Node_Name(
16+
0: Expr_FuncCall(
17+
name: Name(
1818
parts: array(
1919
0: var_dump
2020
)
2121
)
2222
args: array(
23-
0: rser_Node_Arg(
24-
value: rser_Node_Expr_Variable(
23+
0: Arg(
24+
value: Expr_Variable(
2525
name: foo
2626
)
2727
byRef: false
Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,6 @@
1+
{
2+
"require": {
3+
"infection/infection": "dev-master",
4+
"nikic/php-parser": "v3.1.4"
5+
}
6+
}

0 commit comments

Comments
 (0)