PHP Class SimpleErrorQueue, simpletest

ファイルを表示 Open project: simpletest/simpletest Class Usage Examples

Public Methods

Method Description
__construct ( ) Starts with an empty queue.
add ( integer $severity, string $content, string $filename, integer $line ) Adds an error to the front of the queue.
clear ( ) Discards the contents of the error queue.
expectError ( SimpleExpectation $expected, string $message ) Sets up an expectation of an error.
extract ( ) : mixed Pulls the earliest error from the queue.
getSeverityAsString ( $severity ) : String Converts an error code into it's string representation.
setTestCase ( SimpleTestCase $test ) Sets the currently running test case.
tally ( ) Any errors still in the queue are sent to the test case.

Protected Methods

Method Description
extractExpectation ( ) : SimpleExpectation Pulls the earliest expectation from the queue.
testLatestError ( integer $severity, string $content, string $filename, integer $line ) Tests the error against the most recent expected error.

Method Details

__construct() public method

Starts with an empty queue.
public __construct ( )

add() public method

Adds an error to the front of the queue.
public add ( integer $severity, string $content, string $filename, integer $line )
$severity integer PHP error code.
$content string Text of error.
$filename string File error occoured in.
$line integer Line number of error.

clear() public method

Discards the contents of the error queue.
public clear ( )

expectError() public method

If this is not fulfilled at the end of the test, a failure will occour. If the error does happen, then this will cancel it out and send a pass message.
public expectError ( SimpleExpectation $expected, string $message )
$expected SimpleExpectation Expected error match.
$message string Message to display.

extract() public method

The list of error informations contains: - severity as the PHP error code, - the error message, - the file with the error, - the line number and - a list of PHP super global arrays.
public extract ( ) : mixed
return mixed False if none, or a list of error information.

extractExpectation() protected method

Pulls the earliest expectation from the queue.
protected extractExpectation ( ) : SimpleExpectation
return SimpleExpectation False if none.

getSeverityAsString() public static method

Converts an error code into it's string representation.
public static getSeverityAsString ( $severity ) : String
$severity PHP integer error code.
return String version of error code.

setTestCase() public method

Sets the currently running test case.
public setTestCase ( SimpleTestCase $test )
$test SimpleTestCase Test case to send messages to.

tally() public method

Any unfulfilled expectations trigger failures.
public tally ( )

testLatestError() protected method

Tests the error against the most recent expected error.
protected testLatestError ( integer $severity, string $content, string $filename, integer $line )
$severity integer PHP error code.
$content string Text of error.
$filename string File error occoured in.
$line integer Line number of error.