PHP Class SimpleCallSchedule, simpletest

Specific time settings trump lasting ones, otherwise the most recently added will mask an earlier match.
Datei anzeigen Open project: simpletest/simpletest Class Usage Examples

Public Methods

Method Description
__construct ( ) Sets up an empty response schedule. Creates an empty call map.
expectArguments ( string $method, array $args, string $message ) Sets up an expectation on the argument list.
register ( string $method, array $args, SimpleAction $action ) Stores an action against a signature that will always fire unless masked by a time specific one.
registerAt ( integer $step, string $method, array $args, SimpleAction $action ) Stores an action against a signature that will fire at a specific time in the future.
respond ( integer $step, string $method, array $args ) : mixed Actually carry out the action stored previously, if the parameters match.

Protected Methods

Method Description
replaceWildcards ( array $args ) : array Replaces wildcard matches with wildcard expectations in the argument list.

Method Details

__construct() public method

Sets up an empty response schedule. Creates an empty call map.
public __construct ( )

expectArguments() public method

Sets up an expectation on the argument list.
public expectArguments ( string $method, array $args, string $message )
$method string Method to test.
$args array Bare arguments or list of expectation objects.
$message string Failure message.

register() public method

Stores an action against a signature that will always fire unless masked by a time specific one.
public register ( string $method, array $args, SimpleAction $action )
$method string Method name.
$args array Calling parameters.
$action SimpleAction Actually simpleByValue, etc.

registerAt() public method

Stores an action against a signature that will fire at a specific time in the future.
public registerAt ( integer $step, string $method, array $args, SimpleAction $action )
$step integer delay of calls to this method, 0 is next.
$method string Method name.
$args array Calling parameters.
$action SimpleAction Actually SimpleByValue, etc.

replaceWildcards() protected method

Replaces wildcard matches with wildcard expectations in the argument list.
protected replaceWildcards ( array $args ) : array
$args array Raw argument list.
return array Argument list with expectations.

respond() public method

Actually carry out the action stored previously, if the parameters match.
public respond ( integer $step, string $method, array $args ) : mixed
$step integer Time of call.
$method string Method name.
$args array The parameters making up the rest of the call.
return mixed The result of the action.