Skip to content

PHPUnit

Mark Metcalfe edited this page Nov 3, 2021 · 11 revisions

Running PHPUnit from the command line is relatively simple.

Log into one of the PHP containers:

# must run the command from the root of your Totara repo
cd sitefolder
tzsh php-7.4 # or any other php container

Initiate the PHPUnit setup:

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

Run tests:

# Run all tests (can take hours!)
unit

# Run a single test file (the path must be relative to the site root or the full path)
unit path/to/test.php

# Run all tests in a directory
unit server/totara/core

# Run tests tagged with a group
unit --group perform 

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

Clone this wiki locally