PHP Class ParametersExpectation, simpletest

@package SimpleTest
Inheritance: extends SimpleExpectation
Show file Open project: simpletest/simpletest Class Usage Examples

Public Methods

Method Description
__construct ( $expected = false, string $message = '%s' ) Sets the expected parameter list.
test ( array $parameters ) : boolean Tests the assertion. True if correct.
testMessage ( $parameters ) : string Returns a human readable test message.

Protected Methods

Method Description
coerceToExpectation ( mixed $expected ) : SimpleExpectation Creates an identical expectation if the object/value is not already some type of expectation.
describeDifference ( array $expected, array $parameters ) : string Message to display if expectation differs from the parameters actually received.
renderArguments ( array $args ) : string Renders the argument list as a string for messages.
testParameter ( mixed $parameter, mixed $expected ) : boolean Tests an individual parameter.

Method Details

__construct() public method

Sets the expected parameter list.
public __construct ( $expected = false, string $message = '%s' )
$message string Customised message on failure.

coerceToExpectation() protected method

Creates an identical expectation if the object/value is not already some type of expectation.
protected coerceToExpectation ( mixed $expected ) : SimpleExpectation
$expected mixed Expected value.
return SimpleExpectation Expectation object.

describeDifference() protected method

Message to display if expectation differs from the parameters actually received.
protected describeDifference ( array $expected, array $parameters ) : string
$expected array Expected parameters as list.
$parameters array Actual parameters received.
return string Description of difference.

renderArguments() protected method

Renders the argument list as a string for messages.
protected renderArguments ( array $args ) : string
$args array Incoming arguments.
return string Simple description of type and value.

test() public method

Tests the assertion. True if correct.
public test ( array $parameters ) : boolean
$parameters array Comparison values.
return boolean True if correct.

testMessage() public method

Returns a human readable test message.
public testMessage ( $parameters ) : string
return string Description of success or failure.

testParameter() protected method

Tests an individual parameter.
protected testParameter ( mixed $parameter, mixed $expected ) : boolean
$parameter mixed Value to test.
$expected mixed Comparison value.
return boolean True if expectation fulfilled.