PHP Class PHPUnit_Framework_TestResult, phpunit

Author: Sebastian Bergmann ([email protected])
Inheritance: implements Countable
Mostrar archivo Open project: sebastianbergmann/phpunit Class Usage Examples

Protected Properties

Property Type Description
$beStrictAboutOutputDuringTests boolean
$beStrictAboutResourceUsageDuringSmallTests boolean
$beStrictAboutTestsThatDoNotTestAnything boolean
$beStrictAboutTodoAnnotatedTests boolean
$codeCoverage SebastianBergmann\CodeCoverage\CodeCoverage Code Coverage information.
$convertErrorsToExceptions boolean
$enforceTimeLimit boolean
$errors array
$failures array
$lastTestFailed boolean
$listeners array
$notImplemented array
$passed array
$risky array
$runTests integer
$skipped array
$stop boolean
$stopOnError boolean
$stopOnFailure boolean
$stopOnIncomplete boolean
$stopOnRisky boolean
$stopOnSkipped boolean
$stopOnWarning boolean
$time float
$timeoutForLargeTests integer
$timeoutForMediumTests integer
$timeoutForSmallTests integer
$topTestSuite PHPUnit_Framework_TestSuite
$warnings array

Public Methods

Method Description
addError ( PHPUnit_Framework_Test $test, Throwable $t, float $time ) Adds an error to the list of errors.
addFailure ( PHPUnit_Framework_Test $test, PHPUnit_Framework_AssertionFailedError $e, float $time ) Adds a failure to the list of failures.
addListener ( PHPUnit_Framework_TestListener $listener ) Registers a TestListener.
addWarning ( PHPUnit_Framework_Test $test, PHPUnit_Framework_Warning $e, float $time ) Adds a warning to the list of warnings.
allCompletelyImplemented ( ) : boolean Returns true if no incomplete test occurred.
allHarmless ( ) : boolean Returns true if no risky test occurred.
beStrictAboutOutputDuringTests ( boolean $flag )
beStrictAboutResourceUsageDuringSmallTests ( boolean $flag )
beStrictAboutTestsThatDoNotTestAnything ( boolean $flag )
beStrictAboutTodoAnnotatedTests ( boolean $flag )
convertErrorsToExceptions ( boolean $flag ) Enables or disables the error-to-exception conversion.
count ( ) : integer Gets the number of run tests.
endTest ( PHPUnit_Framework_Test $test, float $time ) Informs the result that a test was completed.
endTestSuite ( PHPUnit_Framework_TestSuite $suite ) Informs the result that a testsuite was completed.
enforceTimeLimit ( boolean $flag )
enforcesTimeLimit ( ) : boolean
errorCount ( ) : integer Gets the number of detected errors.
errors ( ) : array Returns an Enumeration for the errors.
failureCount ( ) : integer Gets the number of detected failures.
failures ( ) : array Returns an Enumeration for the failures.
flushListeners ( ) Flushes all flushable TestListeners.
getCodeCoverage ( ) : SebastianBergmann\CodeCoverage\CodeCoverage Returns the code coverage object.
getCollectCodeCoverageInformation ( ) : boolean Returns whether code coverage information should be collected.
getConvertErrorsToExceptions ( ) : boolean Returns the error-to-exception conversion setting.
getTimeoutForLargeTests ( ) : integer Returns the set timeout for large tests.
isStrictAboutOutputDuringTests ( ) : boolean
isStrictAboutResourceUsageDuringSmallTests ( ) : boolean
isStrictAboutTestsThatDoNotTestAnything ( ) : boolean
isStrictAboutTodoAnnotatedTests ( ) : boolean
noneSkipped ( ) : boolean Returns true if no test has been skipped.
notImplemented ( ) : array Returns an Enumeration for the incomplete tests.
notImplementedCount ( ) : integer Gets the number of incomplete tests.
passed ( ) : array Returns the names of the tests that have passed.
removeListener ( PHPUnit_Framework_TestListener $listener ) Unregisters a TestListener.
risky ( ) : array Returns an Enumeration for the risky tests.
riskyCount ( ) : integer Gets the number of risky tests.
run ( PHPUnit_Framework_Test $test ) Runs a TestCase.
setCodeCoverage ( SebastianBergmann\CodeCoverage\CodeCoverage $codeCoverage ) Sets the code coverage object.
setRegisterMockObjectsFromTestArgumentsRecursively ( boolean $flag )
setTimeoutForLargeTests ( integer $timeout ) Sets the timeout for large tests.
setTimeoutForMediumTests ( integer $timeout ) Sets the timeout for medium tests.
setTimeoutForSmallTests ( integer $timeout ) Sets the timeout for small tests.
shouldStop ( ) : boolean Checks whether the test run should stop.
skipped ( ) : array Returns an Enumeration for the skipped tests.
skippedCount ( ) : integer Gets the number of skipped tests.
startTest ( PHPUnit_Framework_Test $test ) Informs the result that a test will be started.
startTestSuite ( PHPUnit_Framework_TestSuite $suite ) Informs the result that a testsuite will be started.
stop ( ) Marks that the test run should stop.
stopOnError ( boolean $flag ) Enables or disables the stopping when an error occurs.
stopOnFailure ( boolean $flag ) Enables or disables the stopping when a failure occurs.
stopOnIncomplete ( boolean $flag ) Enables or disables the stopping for incomplete tests.
stopOnRisky ( boolean $flag ) Enables or disables the stopping for risky tests.
stopOnSkipped ( boolean $flag ) Enables or disables the stopping for skipped tests.
stopOnWarning ( boolean $flag ) Enables or disables the stopping when a warning occurs.
time ( ) : float Returns the time spent running the tests.
topTestSuite ( ) : PHPUnit_Framework_TestSuite Returns the (top) test suite.
warningCount ( ) : integer Gets the number of detected warnings.
warnings ( ) : array Returns an Enumeration for the warnings.
wasSuccessful ( ) : boolean Returns whether the entire test was successful or not.

Protected Methods

Method Description
getHierarchy ( string $className, boolean $asReflectionObjects = false ) : array Returns the class hierarchy for a given class.

Method Details

addError() public method

Adds an error to the list of errors.
public addError ( PHPUnit_Framework_Test $test, Throwable $t, float $time )
$test PHPUnit_Framework_Test
$t Throwable
$time float

addFailure() public method

The passed in exception caused the failure.
public addFailure ( PHPUnit_Framework_Test $test, PHPUnit_Framework_AssertionFailedError $e, float $time )
$test PHPUnit_Framework_Test
$e PHPUnit_Framework_AssertionFailedError
$time float

addListener() public method

Registers a TestListener.
public addListener ( PHPUnit_Framework_TestListener $listener )
$listener PHPUnit_Framework_TestListener

addWarning() public method

The passed in exception caused the warning.
public addWarning ( PHPUnit_Framework_Test $test, PHPUnit_Framework_Warning $e, float $time )
$test PHPUnit_Framework_Test
$e PHPUnit_Framework_Warning
$time float

allCompletelyImplemented() public method

Returns true if no incomplete test occurred.

allHarmless() public method

Returns true if no risky test occurred.
public allHarmless ( ) : boolean
return boolean

beStrictAboutOutputDuringTests() public method

beStrictAboutResourceUsageDuringSmallTests() public method

beStrictAboutTestsThatDoNotTestAnything() public method

beStrictAboutTodoAnnotatedTests() public method

convertErrorsToExceptions() public method

Enables or disables the error-to-exception conversion.
public convertErrorsToExceptions ( boolean $flag )
$flag boolean

count() public method

Gets the number of run tests.
public count ( ) : integer
return integer

endTest() public method

Informs the result that a test was completed.
public endTest ( PHPUnit_Framework_Test $test, float $time )
$test PHPUnit_Framework_Test
$time float

endTestSuite() public method

Informs the result that a testsuite was completed.
public endTestSuite ( PHPUnit_Framework_TestSuite $suite )
$suite PHPUnit_Framework_TestSuite

enforceTimeLimit() public method

public enforceTimeLimit ( boolean $flag )
$flag boolean

enforcesTimeLimit() public method

public enforcesTimeLimit ( ) : boolean
return boolean

errorCount() public method

Gets the number of detected errors.
public errorCount ( ) : integer
return integer

errors() public method

Returns an Enumeration for the errors.
public errors ( ) : array
return array

failureCount() public method

Gets the number of detected failures.
public failureCount ( ) : integer
return integer

failures() public method

Returns an Enumeration for the failures.
public failures ( ) : array
return array

flushListeners() public method

Flushes all flushable TestListeners.
public flushListeners ( )

getCodeCoverage() public method

Returns the code coverage object.
public getCodeCoverage ( ) : SebastianBergmann\CodeCoverage\CodeCoverage
return SebastianBergmann\CodeCoverage\CodeCoverage

getCollectCodeCoverageInformation() public method

Returns whether code coverage information should be collected.
public getCollectCodeCoverageInformation ( ) : boolean
return boolean If code coverage should be collected

getConvertErrorsToExceptions() public method

Returns the error-to-exception conversion setting.

getHierarchy() protected method

Returns the class hierarchy for a given class.
protected getHierarchy ( string $className, boolean $asReflectionObjects = false ) : array
$className string
$asReflectionObjects boolean
return array

getTimeoutForLargeTests() public method

Returns the set timeout for large tests.

isStrictAboutOutputDuringTests() public method

isStrictAboutResourceUsageDuringSmallTests() public method

isStrictAboutTestsThatDoNotTestAnything() public method

isStrictAboutTodoAnnotatedTests() public method

noneSkipped() public method

Returns true if no test has been skipped.
public noneSkipped ( ) : boolean
return boolean

notImplemented() public method

Returns an Enumeration for the incomplete tests.
public notImplemented ( ) : array
return array

notImplementedCount() public method

Gets the number of incomplete tests.
public notImplementedCount ( ) : integer
return integer

passed() public method

Returns the names of the tests that have passed.
public passed ( ) : array
return array

removeListener() public method

Unregisters a TestListener.
public removeListener ( PHPUnit_Framework_TestListener $listener )
$listener PHPUnit_Framework_TestListener

risky() public method

Returns an Enumeration for the risky tests.
public risky ( ) : array
return array

riskyCount() public method

Gets the number of risky tests.
public riskyCount ( ) : integer
return integer

run() public method

Runs a TestCase.
public run ( PHPUnit_Framework_Test $test )
$test PHPUnit_Framework_Test

setCodeCoverage() public method

Sets the code coverage object.
public setCodeCoverage ( SebastianBergmann\CodeCoverage\CodeCoverage $codeCoverage )
$codeCoverage SebastianBergmann\CodeCoverage\CodeCoverage

setRegisterMockObjectsFromTestArgumentsRecursively() public method

setTimeoutForLargeTests() public method

Sets the timeout for large tests.
public setTimeoutForLargeTests ( integer $timeout )
$timeout integer

setTimeoutForMediumTests() public method

Sets the timeout for medium tests.
public setTimeoutForMediumTests ( integer $timeout )
$timeout integer

setTimeoutForSmallTests() public method

Sets the timeout for small tests.
public setTimeoutForSmallTests ( integer $timeout )
$timeout integer

shouldStop() public method

Checks whether the test run should stop.
public shouldStop ( ) : boolean
return boolean

skipped() public method

Returns an Enumeration for the skipped tests.
public skipped ( ) : array
return array

skippedCount() public method

Gets the number of skipped tests.
public skippedCount ( ) : integer
return integer

startTest() public method

Informs the result that a test will be started.
public startTest ( PHPUnit_Framework_Test $test )
$test PHPUnit_Framework_Test

startTestSuite() public method

Informs the result that a testsuite will be started.
public startTestSuite ( PHPUnit_Framework_TestSuite $suite )
$suite PHPUnit_Framework_TestSuite

stop() public method

Marks that the test run should stop.
public stop ( )

stopOnError() public method

Enables or disables the stopping when an error occurs.
public stopOnError ( boolean $flag )
$flag boolean

stopOnFailure() public method

Enables or disables the stopping when a failure occurs.
public stopOnFailure ( boolean $flag )
$flag boolean

stopOnIncomplete() public method

Enables or disables the stopping for incomplete tests.
public stopOnIncomplete ( boolean $flag )
$flag boolean

stopOnRisky() public method

Enables or disables the stopping for risky tests.
public stopOnRisky ( boolean $flag )
$flag boolean

stopOnSkipped() public method

Enables or disables the stopping for skipped tests.
public stopOnSkipped ( boolean $flag )
$flag boolean

stopOnWarning() public method

Enables or disables the stopping when a warning occurs.
public stopOnWarning ( boolean $flag )
$flag boolean

time() public method

Returns the time spent running the tests.
public time ( ) : float
return float

topTestSuite() public method

Returns the (top) test suite.
public topTestSuite ( ) : PHPUnit_Framework_TestSuite
return PHPUnit_Framework_TestSuite

warningCount() public method

Gets the number of detected warnings.
public warningCount ( ) : integer
return integer

warnings() public method

Returns an Enumeration for the warnings.
public warnings ( ) : array
return array

wasSuccessful() public method

Returns whether the entire test was successful or not.
public wasSuccessful ( ) : boolean
return boolean

Property Details

$beStrictAboutOutputDuringTests protected_oe property

protected bool $beStrictAboutOutputDuringTests
return boolean

$beStrictAboutResourceUsageDuringSmallTests protected_oe property

protected bool $beStrictAboutResourceUsageDuringSmallTests
return boolean

$beStrictAboutTestsThatDoNotTestAnything protected_oe property

protected bool $beStrictAboutTestsThatDoNotTestAnything
return boolean

$beStrictAboutTodoAnnotatedTests protected_oe property

protected bool $beStrictAboutTodoAnnotatedTests
return boolean

$codeCoverage protected_oe property

Code Coverage information.
protected CodeCoverage,SebastianBergmann\CodeCoverage $codeCoverage
return SebastianBergmann\CodeCoverage\CodeCoverage

$convertErrorsToExceptions protected_oe property

protected bool $convertErrorsToExceptions
return boolean

$enforceTimeLimit protected_oe property

protected bool $enforceTimeLimit
return boolean

$errors protected_oe property

protected array $errors
return array

$failures protected_oe property

protected array $failures
return array

$lastTestFailed protected_oe property

protected bool $lastTestFailed
return boolean

$listeners protected_oe property

protected array $listeners
return array

$notImplemented protected_oe property

protected array $notImplemented
return array

$passed protected_oe property

protected array $passed
return array

$risky protected_oe property

protected array $risky
return array

$runTests protected_oe property

protected int $runTests
return integer

$skipped protected_oe property

protected array $skipped
return array

$stop protected_oe property

protected bool $stop
return boolean

$stopOnError protected_oe property

protected bool $stopOnError
return boolean

$stopOnFailure protected_oe property

protected bool $stopOnFailure
return boolean

$stopOnIncomplete protected_oe property

protected bool $stopOnIncomplete
return boolean

$stopOnRisky protected_oe property

protected bool $stopOnRisky
return boolean

$stopOnSkipped protected_oe property

protected bool $stopOnSkipped
return boolean

$stopOnWarning protected_oe property

protected bool $stopOnWarning
return boolean

$time protected_oe property

protected float $time
return float

$timeoutForLargeTests protected_oe property

protected int $timeoutForLargeTests
return integer

$timeoutForMediumTests protected_oe property

protected int $timeoutForMediumTests
return integer

$timeoutForSmallTests protected_oe property

protected int $timeoutForSmallTests
return integer

$topTestSuite protected_oe property

protected PHPUnit_Framework_TestSuite $topTestSuite
return PHPUnit_Framework_TestSuite

$warnings protected_oe property

protected array $warnings
return array