Every repository with this icon (
Every repository with this icon (
SnapTest Command Line
SnapTest Command Line Usage
- Usage:
snaptest.sh [--out=outmode] [--php=phppath] [--help] <path> - Usage:
php snaptest.php [--out=outmode] [--php=phppath] [--help] <path>
<path> – The path to the test you want to run. Should be a file
ending in .php or a directory.
--out=outmode – sets the output handler to ‘outmode’. The
output mode must be located in <snaptest>/outmode.php.
| Outmode Name | Description |
|---|---|
| ansitext | An ANSI color version of the default text reporter |
| json | Exports the data in Javascript Standard Object Notation |
| phpserializer | A serialization reporter for large directory spanning unit tests |
| tap | An emulation of the Test Anything Protocol for PERL |
| text | The default text reporter, similar to JUnit |
--php=phppath – set the php path for recursion. If not specified,
the call ‘php’ will be used, using whatever is in the current env
variable.
--match=regex – Specifies a PCRE regular expression to match. Files
that match this regular expression will be included by the test
harness.
Command Line Information
The SnapTest command line provides a shell way of launching the unit testing framework. In order to ensure maximum isolation for each test, the snaptest.php file is ran once for each test file it locates, creating a fresh PHP environment. The popen() call is used as opposed to forking in order to ensure running tests does not introduce an excessive strain on the system. However, this also means that the location of PHP will need to be known in order to run the tests. If you do not have access to a shell, you can use the SnapWebInterface to run tests via a web browser, although performance will be greatly reduced.
The snaptest.sh script is a bash script to provide a passthrough to the PHP script. It attempts to locate PHP automatically, using a predefined set of paths, as well as calling which php to locate a suitable PHP executable. If one cannot be found, you will need to contact your system administrator to get the location of PHP.






