SimpleTestCase
└─ShellTestCase
public class ShellTestCase
extends SimpleTestCase
Constructor Summary | |
---|---|
ShellTestCase(string label) Creates an empty test case. |
Method Summary | |
---|---|
boolean | assertExitCode(integer status, string message) Tests the last status code from the shell. |
boolean | assertFileExists(string path, string message) File existence check. |
boolean | assertFileNotExists(string path, string message) File non-existence check. |
boolean | assertFilePattern(string pattern, string path, string message) Scans a file for a Perl regex. |
boolean | assertNoFilePattern(string pattern, string path, string message) If a Perl regex is found anywhere in the named file then a failure is generated, else a pass. |
boolean | assertNoOutputPattern(string pattern, mixed message, $message Message) If a Perl regex is found anywhere in the current output then a failure is generated, else a pass. |
boolean | assertOutput(string expected, string message) Attempt to exactly match the combined STDERR and STDOUT output. |
boolean | assertOutputPattern(string pattern, string message) Scans the output for a Perl regex. |
void | Dumps the output of the last command. |
boolean | execute(string command) Executes a command and buffers the results. |
string | Accessor for the last output. |
array | Accessor for the last output. |
Methods inherited from SimpleTest\SimpleTestCase | |
---|---|
assertExpectation, assertFalse, assertTrue, createInvoker, dump, error, fail, getAssertionLine, getLabel, getSize, pass, run, sendMessage, setUp, signal, swallowErrors, tearDown |
public ShellTestCase(string label)
Creates an empty test case. Should be subclassed with test methods for a functional test case.
public boolean assertExitCode(integer status, string message)
Tests the last status code from the shell.
public boolean assertFileExists(string path, string message)
File existence check.
public boolean assertFileNotExists(string path, string message)
File non-existence check.
public boolean assertFilePattern(string pattern, string path, string message)
Scans a file for a Perl regex. If found anywhere it passes, else it fails.
public boolean assertNoFilePattern(string pattern, string path, string message)
If a Perl regex is found anywhere in the named file then a failure is generated, else a pass.
public boolean assertNoOutputPattern(string pattern, mixed message, $message Message)
If a Perl regex is found anywhere in the current output then a failure is generated, else a pass.
public boolean assertOutput(string expected, string message)
Attempt to exactly match the combined STDERR and STDOUT output.
public boolean assertOutputPattern(string pattern, string message)
Scans the output for a Perl regex. If found anywhere it passes, else it fails.
public void dumpOutput()
Dumps the output of the last command.
public boolean execute(string command)
Executes a command and buffers the results.
public string getOutput()
Accessor for the last output.
public array getOutputAsList()
Accessor for the last output.
Test case for testing of command line scripts and utilities. Usually scripts taht are external to the PHP code, but support it in some way.