PHP Class ParaTest\Runners\PHPUnit\ResultPrinter

Used for outputing ParaTest results
Mostrar archivo Open project: brianium/paratest Class Usage Examples

Protected Properties

Property Type Description
$casesProcessed integer The total number of cases printed so far
$colors boolean Whether to display a red or green bar
$column integer The current column being printed to
$maxColumn integer Used for formatting results to a given width
$numTestsWidth integer Used to determine when to tally current results and start a new row
$numberOfColumns integer Number of columns
$processSkipped boolean Do we need to try to process skipped/incompleted tests.
$results ParaTest\Logging\LogInterpreter
$suites array A collection of ExecutableTest objects
$timer PHP_Timer
$totalCases integer The total number of cases to be run
$totalSkippedOrIncomplete integer Number of skipped or incomplete tests
$warnings array Warnings generated by the cases

Public Methods

Method Description
__construct ( LogInterpreter $results )
addTest ( ParaTest\Runners\PHPUnit\ExecutableTest $suite ) Adds an ExecutableTest to the tracked results
addWarnings ( array $warnings ) Add an array of warning strings. These cause the test run to be shown as failed
flush ( ) Prints all results and removes any log files used for aggregating results
getErrors ( ) : string Returns error messages
getFailures ( ) : string Returns the failure messages
getFooter ( ) : string Return the footer information reporting success or failure
getHeader ( ) : string Returns the header containing resource usage
getTotalCases ( ) : integer Returns the total cases being printed
getWarnings ( ) Returns warning messages as a string
isSuccessful ( ) : boolean Whether the test run is successful and has no warnings
printFeedback ( ParaTest\Runners\PHPUnit\ExecutableTest $test ) Prints the individual "quick" feedback for run tests, that is the ".EF" items
printResults ( ) Print final results
println ( string $string = "" )
start ( ParaTest\Runners\PHPUnit\Options $options ) Initializes printing constraints, prints header information and starts the test timer

Protected Methods

Method Description
getDefects ( array $defects, $type ) : string Method that returns a formatted string for a collection of errors or failures
getProgress ( ) Prints progress for large test collections
isSkippedIncompleTestCanBeTracked ( $options ) : boolean Is skipped/incomplete amount can be properly processed.
printFeedbackItem ( $item ) Prints a single "quick" feedback item and increments the total number of processed cases and the column position
printSkippedAndIncomplete ( integer $actualTestCount, integer $expectedTestCount ) Prints S for skipped and incomplete tests.
printTestWarnings ( ParaTest\Runners\PHPUnit\ExecutableTest $test ) Prints test warnings.
processReaderFeedback ( ParaTest\Logging\JUnit\Reader $reader, integer $expectedTestCount ) Process reader feedback and print it.
processTestOverhead ( integer $actualTestCount, integer $expectedTestCount ) Process test overhead.

Private Methods

Method Description
clearLogs ( ) Deletes all the temporary log files for ExecutableTest objects being printed
getFailedFooter ( ) : string Get the footer for a test collection that had tests with failures or errors
getSuccessFooter ( ) : string Get the footer for a test collection containing all successful tests
green ( $text )
red ( $text )

Method Details

__construct() public method

public __construct ( LogInterpreter $results )
$results ParaTest\Logging\LogInterpreter

addTest() public method

Adds an ExecutableTest to the tracked results
public addTest ( ParaTest\Runners\PHPUnit\ExecutableTest $suite )
$suite ParaTest\Runners\PHPUnit\ExecutableTest

addWarnings() public method

Add an array of warning strings. These cause the test run to be shown as failed
public addWarnings ( array $warnings )
$warnings array

flush() public method

Prints all results and removes any log files used for aggregating results
public flush ( )

getDefects() protected method

Method that returns a formatted string for a collection of errors or failures
protected getDefects ( array $defects, $type ) : string
$defects array
$type
return string

getErrors() public method

Returns error messages
public getErrors ( ) : string
return string

getFailures() public method

Returns the failure messages
public getFailures ( ) : string
return string

getFooter() public method

Return the footer information reporting success or failure
public getFooter ( ) : string
return string

getHeader() public method

Returns the header containing resource usage
public getHeader ( ) : string
return string

getProgress() protected method

Prints progress for large test collections
protected getProgress ( )

getTotalCases() public method

Returns the total cases being printed
public getTotalCases ( ) : integer
return integer

getWarnings() public method

Returns warning messages as a string
public getWarnings ( )

isSkippedIncompleTestCanBeTracked() protected method

Is skipped/incomplete amount can be properly processed.
protected isSkippedIncompleTestCanBeTracked ( $options ) : boolean
return boolean

isSuccessful() public method

Whether the test run is successful and has no warnings
public isSuccessful ( ) : boolean
return boolean

printFeedback() public method

Prints the individual "quick" feedback for run tests, that is the ".EF" items
public printFeedback ( ParaTest\Runners\PHPUnit\ExecutableTest $test )
$test ParaTest\Runners\PHPUnit\ExecutableTest

printFeedbackItem() protected method

Prints a single "quick" feedback item and increments the total number of processed cases and the column position
protected printFeedbackItem ( $item )
$item

printResults() public method

Print final results
public printResults ( )

printSkippedAndIncomplete() protected method

If for some reason process return less tests than expected then we threat all remaining as skipped or incomplete and print them as skipped (S letter)
protected printSkippedAndIncomplete ( integer $actualTestCount, integer $expectedTestCount )
$actualTestCount integer
$expectedTestCount integer

printTestWarnings() protected method

Prints test warnings.
protected printTestWarnings ( ParaTest\Runners\PHPUnit\ExecutableTest $test )
$test ParaTest\Runners\PHPUnit\ExecutableTest

println() public method

public println ( string $string = "" )
$string string

processReaderFeedback() protected method

Process reader feedback and print it.
protected processReaderFeedback ( ParaTest\Logging\JUnit\Reader $reader, integer $expectedTestCount )
$reader ParaTest\Logging\JUnit\Reader
$expectedTestCount integer

processTestOverhead() protected method

In some situations phpunit can return more tests then we expect and in that case this method correct total amount of tests so paratest progress will be auto corrected.
protected processTestOverhead ( integer $actualTestCount, integer $expectedTestCount )
$actualTestCount integer
$expectedTestCount integer

start() public method

Initializes printing constraints, prints header information and starts the test timer
public start ( ParaTest\Runners\PHPUnit\Options $options )
$options ParaTest\Runners\PHPUnit\Options

Property Details

$casesProcessed protected_oe property

The total number of cases printed so far
protected int $casesProcessed
return integer

$colors protected_oe property

Whether to display a red or green bar
protected bool $colors
return boolean

$column protected_oe property

The current column being printed to
protected int $column
return integer

$maxColumn protected_oe property

Used for formatting results to a given width
protected int $maxColumn
return integer

$numTestsWidth protected_oe property

Used to determine when to tally current results and start a new row
protected int $numTestsWidth
return integer

$numberOfColumns protected_oe property

Number of columns
protected int $numberOfColumns
return integer

$processSkipped protected_oe property

Do we need to try to process skipped/incompleted tests.
protected bool $processSkipped
return boolean

$results protected_oe property

protected LogInterpreter,ParaTest\Logging $results
return ParaTest\Logging\LogInterpreter

$suites protected_oe property

A collection of ExecutableTest objects
protected array $suites
return array

$timer protected_oe property

protected PHP_Timer $timer
return PHP_Timer

$totalCases protected_oe property

The total number of cases to be run
protected int $totalCases
return integer

$totalSkippedOrIncomplete protected_oe property

Number of skipped or incomplete tests
protected int $totalSkippedOrIncomplete
return integer

$warnings protected_oe property

Warnings generated by the cases
protected array $warnings
return array