diff --git a/.github/workflows/test.yml b/.github/workflows/test.yml
index 9e6af5d3..51377202 100644
--- a/.github/workflows/test.yml
+++ b/.github/workflows/test.yml
@@ -43,6 +43,33 @@ jobs:
- name: Tests
run: composer test
+ coverage:
+ name: Code Coverage
+ runs-on: ubuntu-latest
+
+ steps:
+ - name: Checkout
+ uses: actions/checkout@v4
+
+ - name: Install PHP
+ uses: shivammathur/setup-php@v2
+ with:
+ php-version: 8.4
+ coverage: xdebug
+
+ - name: Cache PHP dependencies
+ uses: actions/cache@v4
+ with:
+ path: vendor
+ key: ${{ runner.os }}-php-8.4-composer-${{ hashFiles('**/composer.json') }}
+ restore-keys: ${{ runner.os }}-php-8.4-composer-
+
+ - name: Install dependencies
+ run: composer install
+
+ - name: Run tests with coverage
+ run: composer coverage
+
phpstan:
name: PHPStan Static Analysis
runs-on: ubuntu-latest
diff --git a/.gitignore b/.gitignore
index 29e4a489..51c4c040 100644
--- a/.gitignore
+++ b/.gitignore
@@ -1,6 +1,7 @@
*.cache
*.code-workspace
composer.lock
+coverage-html
env.php
phpunit.xml
vendor
diff --git a/composer.json b/composer.json
index 993f65e5..583af410 100644
--- a/composer.json
+++ b/composer.json
@@ -65,6 +65,8 @@
"scripts": {
"demo": "php -S localhost:8888 demo/index.php",
"test": "phpunit",
+ "coverage": "phpunit --coverage-text",
+ "coverage-report": "phpunit --coverage-html coverage-html",
"cs-fix": "php-cs-fixer fix",
"phpstan": "phpstan --memory-limit=-1",
"update-resources": [
diff --git a/phpunit.xml.dist b/phpunit.xml.dist
index d8e22e25..d706bd80 100644
--- a/phpunit.xml.dist
+++ b/phpunit.xml.dist
@@ -22,4 +22,12 @@
ignore
+
+
+ src
+
+
+ src/resources
+
+