HumHub Documentation (unofficial)

Test
in package
implements TestInterface, Descriptive uses AssertionCounter, CodeCoverage, ErrorLogger, MetadataCollector, IgnoreIfMetadataBlocked

AbstractYes

The most simple testcase (with only one test in it) which can be executed by PHPUnit/Codeception.

It can be extended with included traits. Turning on/off a trait should not break class functionality.

Class has exactly one method to be executed for testing, wrapped with before/after callbacks delivered from included traits. A trait providing before/after callback should contain corresponding protected methods: {traitName}Start and {traitName}End, then this trait should be enabled in hooks property.

Inherited class must implement test method.

Table of Contents

Interfaces

TestInterface
Descriptive

Constants

STATUS_ERROR  = 'error'
STATUS_FAIL  = 'fail'
STATUS_OK  = 'ok'
STATUS_PENDING  = 'pending'

Properties

$hooks  : array<string|int, mixed>
Enabled traits with methods to be called before and after the test.
$numAssertions  : mixed
$ignored  : mixed
$metadata  : Metadata
$testResult  : mixed

Methods

addToAssertionCount()  : mixed
This method is not covered by the backward compatibility promise for PHPUnit, but is nice to have for extensions.
codeCoverageEnd()  : mixed
codeCoverageStart()  : mixed
count()  : mixed
errorLoggerEnd()  : mixed
getFileName()  : mixed
getMetadata()  : mixed
getName()  : mixed
getNumAssertions()  : mixed
getTestResultObject()  : mixed
run()  : TestResult
Runs a test and collects its result in a TestResult instance.
test()  : mixed
Everything inside this method is treated as a test.
toString()  : mixed
Test representation
assertionCounterEnd()  : mixed
assertionCounterStart()  : mixed
ignore()  : mixed
Should a test be skipped (can be set from hooks)
ignoreIfMetadataBlockedStart()  : mixed
setMetadata()  : mixed

Constants

STATUS_ERROR

public mixed STATUS_ERROR = 'error'

STATUS_FAIL

public mixed STATUS_FAIL = 'fail'

STATUS_OK

public mixed STATUS_OK = 'ok'

STATUS_PENDING

public mixed STATUS_PENDING = 'pending'

Properties

$hooks

Enabled traits with methods to be called before and after the test.

protected array<string|int, mixed> $hooks = ['ignoreIfMetadataBlocked', 'codeCoverage', 'assertionCounter', 'errorLogger']

$ignored

private mixed $ignored = false

$testResult

private mixed $testResult

Methods

addToAssertionCount()

This method is not covered by the backward compatibility promise for PHPUnit, but is nice to have for extensions.

public addToAssertionCount(mixed $count) : mixed
Parameters
$count : mixed

codeCoverageEnd()

public codeCoverageEnd(mixed $status, mixed $time) : mixed
Parameters
$status : mixed
$time : mixed

errorLoggerEnd()

public errorLoggerEnd(mixed $status, mixed $time[, mixed $exception = null ]) : mixed
Parameters
$status : mixed
$time : mixed
$exception : mixed = null

getTestResultObject()

public getTestResultObject() : mixed

run()

Runs a test and collects its result in a TestResult instance.

public final run([TestResult $result = null ]) : TestResult

Executes before/after hooks coming from traits.

Parameters
$result : TestResult = null
Return values
TestResult

test()

Everything inside this method is treated as a test.

public abstract test() : mixed

toString()

Test representation

public abstract toString() : mixed

ignore()

Should a test be skipped (can be set from hooks)

protected ignore(bool $ignored) : mixed
Parameters
$ignored : bool

        
On this page

Search results