Skip to content

Commit dd996ad

Browse files
authored
Code coverage (#72)
Code coverage: - UI to check which parts of the projects are covered and which aren't - CI check
1 parent 7823738 commit dd996ad

File tree

16 files changed

+536
-23
lines changed

16 files changed

+536
-23
lines changed

.github/workflows/php.yml

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -38,4 +38,8 @@ jobs:
3838
run: composer install --prefer-dist --no-progress
3939

4040
- name: Run test suite
41-
run: composer run-script test
41+
run: composer test:with-coverage
42+
43+
- name: Check coverage
44+
run: composer test:coverage-level
45+

.gitignore

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -6,3 +6,4 @@ vendor
66
composer.lock
77
node_modules
88
.phpunit.cache
9+
coverage

composer.json

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -8,8 +8,9 @@
88
}
99
],
1010
"scripts": {
11-
"test": "XDEBUG_MODE=coverage vendor/bin/phpunit",
12-
"test:no-coverage": "vendor/bin/phpunit",
11+
"test": "vendor/bin/phpunit --no-coverage",
12+
"test:with-coverage": "XDEBUG_MODE=coverage vendor/bin/phpunit",
13+
"test:coverage-level": "vendor/bin/coverage-check ./coverage/clover.xml 88",
1314
"test:update-snapshots": "vendor/bin/phpunit -d --update-snapshots",
1415
"cs:src": "vendor/bin/php-cs-fixer fix src",
1516
"cs:tests": "vendor/bin/php-cs-fixer fix tests",
@@ -48,6 +49,7 @@
4849
"myclabs/php-enum": "^1.8",
4950
"friendsofphp/php-cs-fixer": "^3.0",
5051
"symfony/var-dumper": "^5.3|^6.0",
51-
"phpstan/phpstan": "^1.7"
52+
"phpstan/phpstan": "^1.7",
53+
"rregeer/phpunit-coverage-check": "^0.3.1"
5254
}
5355
}

0 commit comments

Comments
 (0)