Testing
Esta página aún no está disponible en tu idioma.
This package provides a consistent set of Composer scripts for local validation.
Tool references:
- Actionlint for GitHub Actions workflow linting.
- Codespell for spelling checks.
- Composer Require Checker for dependency definition checks.
- Easy Coding Standard (ECS) for coding standards.
- EditorConfig Checker for EditorConfig compliance.
- Gitleaks for secret scanning.
- Infection for mutation testing.
- Markdownlint-cli2 for Markdown linting.
- PHPStan for static analysis.
- PHPUnit for unit tests.
- Prettier for Markdown and YAML formatting checks.
- Rector for automated refactoring.
- Yamllint for YAML linting.
- Zizmor for GitHub Actions security audits.
Automated refactoring (Rector)
Section titled “Automated refactoring (Rector)”Run Rector to apply automated code refactoring. This command modifies files.
composer rectorValidate Rector without modifying files.
composer rector-checkCoding standards (ECS)
Section titled “Coding standards (ECS)”Check coding standards without modifying files.
composer ecs-checkApply coding standard fixes. This command modifies files.
composer ecsDependency definition check
Section titled “Dependency definition check”Verify that runtime dependencies are correctly declared in composer.json.
composer check-dependenciesMutation testing (Infection)
Section titled “Mutation testing (Infection)”Run mutation testing.
composer mutationRun mutation testing with static analysis enabled.
composer mutation-staticRepository quality checks
Section titled “Repository quality checks”Make actionlint (and its ShellCheck helper), codespell, EditorConfig Checker, markdownlint-cli2, Prettier and yamllint
available on PATH. Run all repository quality checks:
composer qualityEach tool can also be run separately:
composer actionlintcomposer codespellcomposer editorconfig-checkercomposer markdownlintcomposer prettiercomposer yamllintThe codespell, EditorConfig Checker and Markdownlint configurations are in .github/linters. Prettier uses
.prettierignore as its ignore path; yamllint checks .github.
Static analysis (PHPStan)
Section titled “Static analysis (PHPStan)”Run static analysis.
composer staticUnit tests (PHPUnit)
Section titled “Unit tests (PHPUnit)”Run the full test suite.
composer testsWorkflow security checks
Section titled “Workflow security checks”Make zizmor and Gitleaks available on PATH. Run both checks, or either one separately:
composer securitycomposer zizmorcomposer gitleaksZizmor uses the pedantic persona and may need GitHub API access for online audits. To request an offline audit:
composer zizmor -- --offlineReport offline limitations and hosted CI results separately. Gitleaks scans Git history with the repository’s configuration. Review findings instead of disabling the checks.
Passing extra arguments
Section titled “Passing extra arguments”Composer scripts support forwarding additional arguments using --.
Run PHPUnit with code coverage report generation.
composer tests -- --coverage-html code_coverageRun PHPStan with a different memory limit.
composer static -- --memory-limit=512M