Skip to content

PHPUnit tests

The ./script/test script takes care of everything needed to run unit tests. Including:

  • Resetting database to appropriate seed state
  • Clearing config cache and overriding APP_ENV to testing

Prerequisites

Have a development server up and running first:

./script/server

Any environment will work, but use local if you want working tree source code mounted into the container so you can iterate on test code live.

Run all tests

./script/test

Run one test

./script/test tests/Feature/AuditTest.php

Debugging

With Xdebug enabled, breakpoints should catch when running tests with ./script/test

Debug one test

The repository comes with a launch config defined under /.vscode/launch.json that is ready for use with the project. Review its contents for the settings to use with any other IDE.

docker-compose exec app enable-xdebug

./script/test tests/Feature/AuditTest.php