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/*/Unit/ | Isolated class testing |
| Integration | Pest PHP | tests/*/Integration/ | Component interactions |
| Acceptance | Behat | tests/*/Acceptance/ | User scenarios (BDD) |
Running Tests
# Unit tests
task tests:unit
# Integration tests
task tests:integration
# 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:
The HTML report is generated in public/debug/code-coverage/.
Configuration Files
phpunit.xml- Pest/PHPUnit configurationbehat.yml- Behat acceptance test suitestests/Pest.php- Pest bootstrap