Testing
Phexium employs a three-level testing strategy: unit tests, integration tests, and acceptance tests.
In This Section
- Strategy Overview - Testing philosophy and approach
- Unit Testing - Pest PHP unit tests
- Integration Testing - Component integration tests
- Acceptance Testing (Behat) - BDD acceptance tests
- Test Doubles - Fakes and spies for isolated testing
- Mutation Testing - Test quality verification
Test Categories
| Type | Framework | Location | Purpose |
|---|---|---|---|
| Unit | Pest PHP | tests/*/Component/ (group: unit) | Isolated class testing |
| Integration | Pest PHP | tests/*/Component/ (group: integration) | Component interactions |
| Acceptance | Behat | tests/*/Acceptance/ | User scenarios (BDD) |
Running Tests
# Unit tests
task tests:unit
# Integration tests
task tests:integration
# All Pest tests (unit + integration)
task tests:component
# Acceptance tests
task tests:acceptance # All implementations
task tests:acceptance:inmemory # Fastest (no database)
# All tests with merged coverage
task tests:all
# Mutation testing
task tests:mutation
Code Coverage
The merged code coverage report is published on GitLab Pages after each CI pipeline run on the trunk branch.
View coverage report:
To generate the report locally:
This merges the .cov artifacts from public/debug/reports/ into an HTML report in public/debug/coverage/, plus a compact text summary in public/debug/coverage.txt listing the uncovered line ranges per file.
Configuration Files
phpunit.xml- Pest/PHPUnit configurationbehat.yml- Behat acceptance test suitestests/Pest.php- Pest bootstrap