PHP Class Peridot\Core\Test

Inheritance: extends Peridot\Core\AbstractTest
ファイルを表示 Open project: peridot-php/peridot Class Usage Examples

Public Methods

Method Description
__construct ( string $description, callable $definition = null )
run ( Peridot\Core\TestResult $result ) : void Execute the test along with any setup and tear down functions.

Protected Methods

Method Description
executeTest ( Peridot\Core\TestResult $result ) Attempt to execute setup functions and run the test definition
failIfPassing ( array &$action, mixed $error ) Fail the test, but do not overwrite existing failures
handleErrors ( Peridot\Core\TestResult $result, array &$action ) : callable | null Set an error handler to handle errors within the test
restoreErrorHandler ( callable | null $handler ) Restore the previous error handler
runSetup ( ) Excecute the test's setup functions
runTearDown ( Peridot\Core\TestResult $result, array $action ) Run the tests tear down methods and have the result perform the method indicated by $action

Method Details

__construct() public method

public __construct ( string $description, callable $definition = null )
$description string
$definition callable

executeTest() protected method

Attempt to execute setup functions and run the test definition
protected executeTest ( Peridot\Core\TestResult $result )
$result Peridot\Core\TestResult

failIfPassing() protected method

Fail the test, but do not overwrite existing failures
protected failIfPassing ( array &$action, mixed $error )
$action array
$error mixed

handleErrors() protected method

Set an error handler to handle errors within the test
protected handleErrors ( Peridot\Core\TestResult $result, array &$action ) : callable | null
$result Peridot\Core\TestResult
$action array
return callable | null

restoreErrorHandler() protected method

Restore the previous error handler
protected restoreErrorHandler ( callable | null $handler )
$handler callable | null

run() public method

Execute the test along with any setup and tear down functions.
public run ( Peridot\Core\TestResult $result ) : void
$result Peridot\Core\TestResult
return void

runSetup() protected method

Excecute the test's setup functions
protected runSetup ( )

runTearDown() protected method

Run the tests tear down methods and have the result perform the method indicated by $action
protected runTearDown ( Peridot\Core\TestResult $result, array $action )
$result Peridot\Core\TestResult
$action array