Skip to content

Commit ce830ba

Browse files
committed
Add code coverage report script
1 parent e81e13e commit ce830ba

File tree

4 files changed

+15
-2
lines changed

4 files changed

+15
-2
lines changed

.gitignore

+2-1
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,4 @@
11
*.cache
22
vendor/
3-
*.lock
3+
*.lock
4+
coverage/

README.md

+6
Original file line numberDiff line numberDiff line change
@@ -139,6 +139,12 @@ Run your tests to verify that slugs are generated as expected:
139139
composer test
140140
```
141141

142+
Run code coverage analysis to generate a coverage report. This will generate a coverage report in the `coverage` directory.
143+
144+
```bash
145+
composer coverage
146+
```
147+
142148
Run PHPStan to check for potential issues in the code:
143149

144150
```bash

composer.json

+2-1
Original file line numberDiff line numberDiff line change
@@ -34,7 +34,8 @@
3434
"scripts": {
3535
"phpcs-fix": "./vendor/bin/php-cs-fixer fix ",
3636
"phpstan": "./vendor/bin/phpstan analyse --memory-limit=-1 src/",
37-
"test": "./vendor/bin/phpunit --testdox"
37+
"test": "./vendor/bin/phpunit --testdox",
38+
"coverage": "./vendor/bin/phpunit --coverage-html coverage/"
3839
},
3940
"config": {
4041
"sort-packages": true

phpunit.xml

+5
Original file line numberDiff line numberDiff line change
@@ -10,4 +10,9 @@
1010
<env name="DB_CONNECTION" value="sqlite"/>
1111
<env name="DB_DATABASE" value=":memory:"/>
1212
</php>
13+
<source>
14+
<include>
15+
<directory suffix=".php">src/</directory>
16+
</include>
17+
</source>
1318
</phpunit>

0 commit comments

Comments
 (0)