class ResultPrinter extends Printer implements TestListener (View source)

Prints the result of a TextUI TestRunner run.

Constants

EVENT_TEST_START

EVENT_TEST_END

EVENT_TESTSUITE_START

EVENT_TESTSUITE_END

COLOR_NEVER

COLOR_AUTO

COLOR_ALWAYS

COLOR_DEFAULT

Properties

protected bool $autoFlush If true, flush output after every write. from Printer
protected resource $out from Printer
protected string $outTarget from Printer
protected int $column
protected int $maxColumn
protected bool $lastTestFailed
protected int $numAssertions
protected int $numTests
protected int $numTestsRun
protected int $numTestsWidth
protected bool $colors
protected bool $debug
protected bool $verbose

Methods

__construct(mixed $out = null, bool $verbose = false, string $colors = self::COLOR_DEFAULT, bool $debug = false, int|string $numberOfColumns = 80, bool $reverse = false)

Constructor.

flush()

Flush buffer and close output if it's not to a PHP stream

from Printer
incrementalFlush()

Performs a safe, incremental flush.

from Printer
write(string $buffer)

No description

from Printer
bool
getAutoFlush()

Check auto-flush mode.

from Printer
setAutoFlush(bool $autoFlush)

Set auto-flushing mode.

from Printer
printResult(TestResult $result)

No description

printDefects(array $defects, string $type)

No description

printDefect(TestFailure $defect, int $count)

No description

printDefectHeader(TestFailure $defect, int $count)

No description

printDefectTrace(TestFailure $defect)

No description

printErrors(TestResult $result)

No description

printFailures(TestResult $result)

No description

printWarnings(TestResult $result)

No description

printIncompletes(TestResult $result)

No description

printRisky(TestResult $result)

No description

printSkipped(TestResult $result)

No description

printHeader()

No description

printFooter(TestResult $result)

No description

printWaitPrompt()

No description

addError(Test $test, Exception $e, float $time)

An error occurred.

addFailure(Test $test, AssertionFailedError $e, float $time)

A failure occurred.

addWarning(Test $test, Warning $e, float $time)

A warning occurred.

addIncompleteTest(Test $test, Exception $e, float $time)

Incomplete test.

addRiskyTest(Test $test, Exception $e, float $time)

Risky test.

addSkippedTest(Test $test, Exception $e, float $time)

Skipped test.

startTestSuite(TestSuite $suite)

A testsuite started.

endTestSuite(TestSuite $suite)

A testsuite ended.

startTest(Test $test)

A test started.

endTest(Test $test, float $time)

A test ended.

writeProgress(string $progress)

No description

writeNewLine()

No description

string
formatWithColor(string $color, string $buffer)

Formats a buffer with a specified ANSI color sequence if colors are enabled.

writeWithColor(string $color, string $buffer, bool $lf = true)

Writes a buffer out with a color sequence if colors are enabled.

writeProgressWithColor(string $color, string $buffer)

Writes progress with a color sequence if colors are enabled.

Details

__construct(mixed $out = null, bool $verbose = false, string $colors = self::COLOR_DEFAULT, bool $debug = false, int|string $numberOfColumns = 80, bool $reverse = false)

Constructor.

Parameters

mixed $out
bool $verbose
string $colors
bool $debug
int|string $numberOfColumns
bool $reverse

Exceptions

Exception

flush()

Flush buffer and close output if it's not to a PHP stream

incrementalFlush()

Performs a safe, incremental flush.

Do not confuse this function with the flush() function of this class, since the flush() function may close the file being written to, rendering the current object no longer usable.

write(string $buffer)

Parameters

string $buffer

bool getAutoFlush()

Check auto-flush mode.

Return Value

bool

setAutoFlush(bool $autoFlush)

Set auto-flushing mode.

If set, incremental flushes will be done after each write. This should not be confused with the different effects of this class' flush() method.

Parameters

bool $autoFlush

printResult(TestResult $result)

Parameters

TestResult $result

protected printDefects(array $defects, string $type)

Parameters

array $defects
string $type

protected printDefect(TestFailure $defect, int $count)

Parameters

TestFailure $defect
int $count

protected printDefectHeader(TestFailure $defect, int $count)

Parameters

TestFailure $defect
int $count

protected printDefectTrace(TestFailure $defect)

Parameters

TestFailure $defect

protected printErrors(TestResult $result)

Parameters

TestResult $result

protected printFailures(TestResult $result)

Parameters

TestResult $result

protected printWarnings(TestResult $result)

Parameters

TestResult $result

protected printIncompletes(TestResult $result)

Parameters

TestResult $result

protected printRisky(TestResult $result)

Parameters

TestResult $result

protected printSkipped(TestResult $result)

Parameters

TestResult $result

protected printHeader()

protected printFooter(TestResult $result)

Parameters

TestResult $result

printWaitPrompt()

addError(Test $test, Exception $e, float $time)

An error occurred.

Parameters

Test $test
Exception $e
float $time

addFailure(Test $test, AssertionFailedError $e, float $time)

A failure occurred.

Parameters

Test $test
AssertionFailedError $e
float $time

addWarning(Test $test, Warning $e, float $time)

A warning occurred.

Parameters

Test $test
Warning $e
float $time

addIncompleteTest(Test $test, Exception $e, float $time)

Incomplete test.

Parameters

Test $test
Exception $e
float $time

addRiskyTest(Test $test, Exception $e, float $time)

Risky test.

Parameters

Test $test
Exception $e
float $time

addSkippedTest(Test $test, Exception $e, float $time)

Skipped test.

Parameters

Test $test
Exception $e
float $time

startTestSuite(TestSuite $suite)

A testsuite started.

Parameters

TestSuite $suite

endTestSuite(TestSuite $suite)

A testsuite ended.

Parameters

TestSuite $suite

startTest(Test $test)

A test started.

Parameters

Test $test

endTest(Test $test, float $time)

A test ended.

Parameters

Test $test
float $time

protected writeProgress(string $progress)

Parameters

string $progress

protected writeNewLine()

protected string formatWithColor(string $color, string $buffer)

Formats a buffer with a specified ANSI color sequence if colors are enabled.

Parameters

string $color
string $buffer

Return Value

string

protected writeWithColor(string $color, string $buffer, bool $lf = true)

Writes a buffer out with a color sequence if colors are enabled.

Parameters

string $color
string $buffer
bool $lf

protected writeProgressWithColor(string $color, string $buffer)

Writes progress with a color sequence if colors are enabled.

Parameters

string $color
string $buffer