Skip to content

PHPUnit

Mark Metcalfe edited this page Aug 11, 2021 · 12 revisions

Running PHPUnit from the command line is relatively simple.

Log into one of the PHP containers:

cd sitefolder # must run the command from the root of your Totara repo
tzsh php-7.3 # or other php containers, as mentioned above

If needed, initiate the PHPUnit setup:

# See shell/aliases.sh.dist for what this alias does
installunit

Run tests:

# See shell/aliases.sh.dist for what these aliases do
# Run all tests (in parallel across 4 processes - it can take a long time!)
unitparallel --processes=4
# Run a single test file
unit relative/path/to/test.php
# Run all tests in a directory
unitdir totara/core

See this page for instructions on how to run PHPUnit directly within PHPStorm.

Clone this wiki locally