A PHPUnit TestListener that exposes your slowest running tests by outputting results directly to the console.

package bbPress

 Methods

Construct a new instance.

__construct(array $options = array()

Parameters

$options

array

An error occurred.

addError(\PHPUnit_Framework_Test $test, \Exception $e, float $time) 

Parameters

$test

\PHPUnit_Framework_Test

$e

\Exception

$time

float

A failure occurred.

addFailure(\PHPUnit_Framework_Test $test, \PHPUnit_Framework_AssertionFailedError $e, float $time) 

Parameters

$test

\PHPUnit_Framework_Test

$e

\PHPUnit_Framework_AssertionFailedError

$time

float

Incomplete test.

addIncompleteTest(\PHPUnit_Framework_Test $test, \Exception $e, float $time) 

Parameters

$test

\PHPUnit_Framework_Test

$e

\Exception

$time

float

Risky test.

addRiskyTest(\PHPUnit_Framework_Test $test, \Exception $e, float $time) 
since Method available since Release 4.0.0

Parameters

$test

\PHPUnit_Framework_Test

$e

\Exception

$time

float

Skipped test.

addSkippedTest(\PHPUnit_Framework_Test $test, \Exception $e, float $time) 

Parameters

$test

\PHPUnit_Framework_Test

$e

\Exception

$time

float

A warning occurred.

addWarning(\PHPUnit_Framework_Test $test, \PHPUnit_Framework_Warning $e, float $time) 
since Method available since Release 5.1.0

Parameters

$test

\PHPUnit_Framework_Test

$e

\PHPUnit_Framework_Warning

$time

float

A test ended.

endTest(\PHPUnit_Framework_Test $test, float $time) 

Parameters

$test

\PHPUnit_Framework_Test

$time

float

A test suite ended.

endTestSuite(\PHPUnit_Framework_TestSuite $suite) 

Parameters

$suite

\PHPUnit_Framework_TestSuite

A test started.

startTest(\PHPUnit_Framework_Test $test) 

Parameters

$test

\PHPUnit_Framework_Test

A test suite started.

startTestSuite(\PHPUnit_Framework_TestSuite $suite) 

Parameters

$suite

\PHPUnit_Framework_TestSuite

Stores a test as slow.

addSlowTest(\PHPUnit_Framework_TestCase $test, integer $time) 

Parameters

$test

\PHPUnit_Framework_TestCase

$time

integer

Test execution time in milliseconds

Find how many slow tests occurred that won't be shown due to list length.

getHiddenCount() : integer

Returns

integerNumber of hidden slow tests

Calculate number of slow tests to report about.

getReportLength() : integer

Returns

integer

Get slow test threshold for given test. A TestCase can override the suite-wide slow threshold by using the annotation @slowThreshold with the threshold value in milliseconds.

getSlowThreshold(\PHPUnit_Framework_TestCase $test) : integer

The following test will only be considered slow when its execution time reaches 5000ms (5 seconds):

slowThreshold 5000 public function testLongRunningProcess() {}

Parameters

$test

\PHPUnit_Framework_TestCase

Returns

integer

Whether at least one test has been considered slow.

hasSlowTests() : boolean

Returns

boolean

Whether the given test execution time is considered slow.

isSlow(integer $time, integer $slowThreshold) : boolean

Parameters

$time

integer

Test execution time in milliseconds

$slowThreshold

integer

Test execution time at which a test should be considered slow (milliseconds)

Returns

boolean

Populate options into class internals.

loadOptions(array $options) 

Parameters

$options

array

Label for describing a test.

makeLabel(\PHPUnit_Framework_TestCase $test) : string

Parameters

$test

\PHPUnit_Framework_TestCase

Returns

string

Renders slow test report body.

renderBody() 

Renders slow test report footer.

renderFooter() 

Renders slow test report header.

renderHeader() 

Convert PHPUnit's reported test time (microseconds) to milliseconds.

toMilliseconds(float $time) : integer

Parameters

$time

float

Returns

integer

 Properties

 

Number of tests to report on for slowness.

$reportLength : integer

Default

 

Collection of slow tests.

$slow : array

Default

array()
 

Time in milliseconds at which a test will be considered "slow" and be reported by this listener.

$slowThreshold : integer

Default

 

Internal tracking for test suites.

$suites : integer

Default

0

Increments as more suites are run, then decremented as they finish. All suites have been run when returns to 0.