Skip to content

Commit 6f1542f

Browse files
committed
Add test-coverage Composer script
1 parent 846e011 commit 6f1542f

File tree

2 files changed

+12
-0
lines changed

2 files changed

+12
-0
lines changed

.gitignore

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,7 @@ composer.lock
55
# php (phpunit)
66
build/logs/
77
.phpunit.result.cache
8+
/.phpunit.result/
89

910
# phpcs fixer
1011
.php_cs.cache

composer.json

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -38,5 +38,16 @@
3838
"psr-4": {
3939
"voku\\tests\\": "tests/"
4040
}
41+
},
42+
"scripts": {
43+
"test-coverage": [
44+
"Composer\\Config::disableProcessTimeout",
45+
"if [ \"$XDEBUG_MODE\" != \"coverage\" ]; then echo \"Run with 'XDEBUG_MODE=coverage composer test-coverage'\"; exit 1; fi;",
46+
"phpunit --coverage-text --coverage-clover .phpunit.result/unitclover.xml --coverage-php .phpunit.result/unitphp.cov --coverage-html .phpunit.result/html -d memory_limit=-1 --order-by=random",
47+
"# Run 'open ./.phpunit.result/html/index.html' to view report."
48+
]
49+
},
50+
"scripts-descriptions": {
51+
"test-coverage": "Run PHPUnit tests with coverage. Use 'XDEBUG_MODE=coverage composer test-coverage' to run, 'open ./.phpunit.result/html/index.html' to view."
4152
}
4253
}

0 commit comments

Comments
 (0)