The test suite has three levels: Type, Unit & Integration.
Type tests - also known as Static Analysis - relate to PHPStan tests, served by Larastan for this project.
$ compser test:types
# ... {runs the type tests for the project}
Unit tests relate to PHPUnit based tests, as configured by the PHPUnit config file
$ php artisan test
# ... {runs the unit tests for the project}
Integration tests for this project consist of [Dusk] browser tests.
$ php artisan dusk
# ... {runs the integration tests for the project}
# If the output begins with 'Warning: TTY mode is not supported on {local OS} platform.',
# use the following to avoid the warning & display colours in the CLI output:
$ php artisan dusk --without-tty --colors=always
# ... {runs the integration tests for the project}
Whether the tests use Dark Mode is dependent on the relevant OS settings.
Make sure the APP_URL
variable in the DotEnv file matches the URL used to access the app in a browser locally.
You can set-up an environment specific DotEnv for testing with:
$ cp .env.example .env.dusk.{ENV}
# ... {copies the example DotEnv file to a live copy ignoring values in any other DotEnv file
# where {ENV} is the type of the local environment
# e.g. `.env.dusk.local`, `.env.dusk.testing`}
To run the type tests with a local phpstan.neon
file for experimentation use:
$ ./vendor/bin/phpstan analyse -c phpstan.neon --memory-limit=2G
# ... {run the types test with the given config}
$ php artisan test --parallel
# ... {runs all tests in parallel}
$ php artisan test --retry
# ... {runs any tests that failed on the last run first for each test suite}
$ php artisan test --profile --compact
# ... {tests run with minimal reporting because of --compact}
# Top 10 slowest tests:
# ... {shows details about the time taken by those tests because of --profile}
$ php artisan test --filter Controller --bail
# PASS Tests\Feature\App\...
# ... {acts the same as PHPUnit's `--stop-on-error --stop-on-failure` because of --bail}
Run the browser test suite with:
$ php artisan dusk
# ... DevTools listening on ws:...
# ... {runs the browser i.e. integration tests for the project}
$ php artisan dusk --stop-on-error --stop-on-failure
# ... DevTools listening on ws:...
# ... {long-form version of --bail}
Prev | Next |
---|---|
<<< Contributing <<< .............................. | ........................................ >>> Releases >>> |