PHP Unit Testing Framework 1
A Unit testing framework for PHP.
Public Member Functions | Protected Member Functions

TestRunner Class Reference

Enables the tests to be executed and a report produced. More...

Inheritance diagram for TestRunner:
TestSuiteResult XMLTestRunner XMLTestRunnerWithStyleSheet TextTestRunner XHTMLTestRunner

Public Member Functions

 GetNumberOfTestCaseResults ()
 GetTestCaseResult ($index)
 Report ()

Protected Member Functions

 Run (TestSuite &$suite, $filename, $extension)

Detailed Description

Enables the tests to be executed and a report produced.

Constructs a runner, to run and report all the test cases. Needs to be sub-classed to generate a report of the appropriate format.

See XMLTestRunner for example.

Todo:
Produce a test runner for rich text format.

Definition at line 1574 of file php_unit_test.php.


Member Function Documentation

GetNumberOfTestCaseResults ( )

Returns the number of test case results.

Returns:
The number of test cases in the results.

Definition at line 1580 of file php_unit_test.php.

GetTestCaseResult ( index)

Returns a test case result for a particular test case.

Parameters:
[in]integer$indexAn index for the test case.
Returns:
Returns a TestCaseResult.

Definition at line 1590 of file php_unit_test.php.

Report ( ) [abstract]

This abstract method to be implemented to product the report in the desired format.

Reimplemented in XMLTestRunner, and XMLTestRunnerWithStyleSheet.

Run ( TestSuite &$  suite,
filename,
extension 
) [protected]

Runs all the test cases in the $suite, with the option of storing the results in a file.

Parameters:
[in]TestSuite&$suiteThe suite of tests to run.
[in]string$filenameFilename is either:

  • null - stdout is used;
  • '' - A temporary filename is used, with the filename written to stdout;
  • any other string - The given filename is used.
[in]string$extensionThe extension to use for the file.
Returns:
Returns one of the following values:
  • 0 - All tests passed;
  • -1 - One or more tests failed;
  • -2 - Unable to open file;
  • -3 - Unable to write to file.

Reimplemented in TextTestRunner, XHTMLTestRunner, and XMLTestRunner.

Definition at line 1611 of file php_unit_test.php.


The documentation for this class was generated from the following file:
 All Data Structures Files Functions Variables

© 2011, Ed Heal