Running tests
Test commands
To validate your code and run all checks and tests (excluding browser tests):
bash
composer run-script test
To validate your code and run all checks and tests:
bash
composer run-script test:full
# Alternatively:
composer run-script test:all
To fix all code and sync environment variables:
bash
composer run-script fix
Running tests (in parallel)
Runs tests using multiple processes, so tests finish a lot faster. The faster your computer is, the more processes you can use. If you have 6 processor cores you can set this to 6 or auto
and it will spawn 6 processes. Do make sure you then have 6 test databases it can use.
shell
composer run-script test:php
# Alternatively:
php artisan test --parallel
php artisan test --parallel --processes=4
php artisan test --parallel --order-by-random
php artisan test --parallel --order-by-random --random-order-seed=1603375222
php artisan test --parallel --order-by-random --testsuite=Unit
Running tests using PHPStorm
Go to the Run
menu > Edit Configurations...
to set up quick testing in your IDE.
Running all tests
- Defined in
phpunit.xml
configuration file
Running test suites
- Defined in
phpunit.xml
configuration file - Test runner options:
--testsuite=Unit
- Optionally, add:
--order-by=random
to run the test randomly and catch setup mistakes