Documentation

CustomPrinter extends PHPUnit_TextUI_ResultPrinter
in package

Prints the result of a TextUI TestRunner run.

Table of Contents

COLOR_ALWAYS  = 'always'
COLOR_AUTO  = 'auto'
COLOR_DEFAULT  = self::COLOR_NEVER
COLOR_NEVER  = 'never'
EVENT_TEST_END  = 1
EVENT_TEST_START  = 0
EVENT_TESTSUITE_END  = 3
EVENT_TESTSUITE_START  = 2
$autoFlush  : bool
If true, flush output after every write.
$colors  : bool
$column  : int
$debug  : bool
$lastTestFailed  : bool
$maxColumn  : int
$numAssertions  : int
$numTests  : int
$numTestsRun  : int
$numTestsWidth  : int
$out  : resource
$outTarget  : string
$printsHTML  : bool
$verbose  : bool
$ansiCodes  : array<string|int, mixed>
$numberOfColumns  : int
__construct()  : mixed
Constructor.
addError()  : mixed
An error occurred.
addFailure()  : mixed
A failure occurred.
addIncompleteTest()  : mixed
Incomplete test.
addRiskyTest()  : mixed
Risky test.
addSkippedTest()  : mixed
Skipped test.
endTest()  : mixed
A test ended.
endTestSuite()  : mixed
A testsuite ended.
flush()  : mixed
Flush buffer, optionally tidy up HTML, and close output if it's not to a php stream
getAutoFlush()  : bool
Check auto-flush mode.
incrementalFlush()  : mixed
Performs a safe, incremental flush.
printResult()  : mixed
printWaitPrompt()  : mixed
setAutoFlush()  : mixed
Set auto-flushing mode.
startTest()  : mixed
A test started.
startTestSuite()  : mixed
A testsuite started.
write()  : mixed
formatWithColor()  : string
Formats a buffer with a specified ANSI color sequence if colors are enabled.
printDefect()  : mixed
printDefectHeader()  : mixed
printDefects()  : mixed
printDefectTrace()  : mixed
printErrors()  : mixed
printFailures()  : mixed
printFooter()  : mixed
printHeader()  : mixed
printIncompletes()  : mixed
printRisky()  : mixed
printSkipped()  : mixed
writeNewLine()  : mixed
writeProgress()  : mixed
writeProgressWithColor()  : mixed
Writes progress with a color sequence if colors are enabled.
writeWithColor()  : mixed
Writes a buffer out with a color sequence if colors are enabled.
writeCountString()  : mixed

Constants

COLOR_DEFAULT

public mixed COLOR_DEFAULT = self::COLOR_NEVER

EVENT_TESTSUITE_START

public mixed EVENT_TESTSUITE_START = 2

Properties

$autoFlush

If true, flush output after every write.

protected bool $autoFlush = alse

$outTarget

protected string $outTarget

$printsHTML

protected bool $printsHTML = alse

$ansiCodes

private static array<string|int, mixed> $ansiCodes = array('bold' => 1, 'fg-black' => 30, 'fg-red' => 31, 'fg-green' => 32, 'fg-yellow' => 33, 'fg-blue' => 34, 'fg-magenta' => 35, 'fg-cyan' => 36, 'fg-white' => 37, 'bg-black' => 40, 'bg-red' => 41, 'bg-green' => 42, 'bg-yellow' => 43, 'bg-blue' => 44, 'bg-magenta' => 45, 'bg-cyan' => 46, 'bg-white' => 47)

Methods

__construct()

Constructor.

public __construct([mixed $out = null ]) : mixed
Parameters
$out : mixed = null
Tags
throws
PHPUnit_Framework_Exception
Return values
mixed

flush()

Flush buffer, optionally tidy up HTML, and close output if it's not to a php stream

public flush() : mixed
Return values
mixed

getAutoFlush()

Check auto-flush mode.

public getAutoFlush() : bool
Tags
since

Method available since Release 3.3.0

Return values
bool

incrementalFlush()

Performs a safe, incremental flush.

public incrementalFlush() : mixed

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.

Tags
since

Method available since Release 3.3.0

Return values
mixed

printWaitPrompt()

public printWaitPrompt() : mixed
Return values
mixed

setAutoFlush()

Set auto-flushing mode.

public setAutoFlush(bool $autoFlush) : mixed

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
$autoFlush : bool
Tags
since

Method available since Release 3.3.0

Return values
mixed

write()

public write(string $buffer) : mixed
Parameters
$buffer : string
Return values
mixed

formatWithColor()

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

protected formatWithColor(string $color, string $buffer) : string
Parameters
$color : string
$buffer : string
Tags
since

Method available since Release 4.0.0

Return values
string

printDefects()

protected printDefects(array<string|int, mixed> $defects, string $type) : mixed
Parameters
$defects : array<string|int, mixed>
$type : string
Return values
mixed

printHeader()

protected printHeader() : mixed
Return values
mixed

writeNewLine()

protected writeNewLine() : mixed
Return values
mixed

writeProgress()

protected writeProgress(string $progress) : mixed
Parameters
$progress : string
Return values
mixed

writeProgressWithColor()

Writes progress with a color sequence if colors are enabled.

protected writeProgressWithColor(string $color, string $buffer) : mixed
Parameters
$color : string
$buffer : string
Tags
since

Method available since Release 4.0.0

Return values
mixed

writeWithColor()

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

protected writeWithColor(string $color, string $buffer[, bool $lf = true ]) : mixed
Parameters
$color : string
$buffer : string
$lf : bool = true
Tags
since

Method available since Release 4.0.0

Return values
mixed

writeCountString()

private writeCountString(int $count, string $name, string $color[, bool $always = false ]) : mixed
Parameters
$count : int
$name : string
$color : string
$always : bool = false
Tags
since

Method available since Release 4.6.5

Return values
mixed

Search results