All test methods must follow the snake_case convention and be descriptive about what they are testing:
public function test_some_functionality_works(): void
{
// Test code here
}Or when using PHPUnit attributes:
#[Test]
public function some_functionality_works(): void
{
// Test code here
}- Group tests by the class they are testing
- Organize test methods in a logical order:
- Happy path tests first
- Edge cases second
- Error cases last
- All new code should have corresponding tests
- Run
make coverageto generate a coverage report
# Run all tests
make test
# Run tests with coverage report
make coverageTests follow the same code style as the main codebase, with the exception of method naming. The code style is automatically enforced using PHP-CS-Fixer with custom rules for test methods.
To check and fix code style:
# Check code style
make cs
# Fix code style automatically
make csfix