PHP Class PHPUnit_Framework_Constraint, phpunit

Author: Sebastian Bergmann ([email protected])
Inheritance: implements Countable, implements PHPUnit_Framework_SelfDescribing
Show file Open project: sebastianbergmann/phpunit Class Usage Examples

Protected Properties

Property Type Description
$exporter

Public Methods

Method Description
__construct ( )
count ( ) : integer Counts the number of constraint elements.
evaluate ( mixed $other, string $description = '', boolean $returnResult = false ) : mixed Evaluates the constraint for parameter $other

Protected Methods

Method Description
additionalFailureDescription ( mixed $other ) : string Return additional failure description where needed
fail ( mixed $other, string $description, SebastianBergmann\Comparator\ComparisonFailure $comparisonFailure = null ) Throws an exception for the given compared value and test description
failureDescription ( mixed $other ) : string Returns the description of the failure
matches ( mixed $other ) : boolean Evaluates the constraint for parameter $other. Returns true if the constraint is met, false otherwise.

Method Details

__construct() public method

public __construct ( )

additionalFailureDescription() protected method

The function can be overridden to provide additional failure information like a diff
protected additionalFailureDescription ( mixed $other ) : string
$other mixed Evaluated value or object.
return string

count() public method

Counts the number of constraint elements.
public count ( ) : integer
return integer

evaluate() public method

If $returnResult is set to false (the default), an exception is thrown in case of a failure. null is returned otherwise. If $returnResult is true, the result of the evaluation is returned as a boolean value instead: true in case of success, false in case of a failure.
public evaluate ( mixed $other, string $description = '', boolean $returnResult = false ) : mixed
$other mixed Value or object to evaluate.
$description string Additional information about the test
$returnResult boolean Whether to return a result or throw an exception
return mixed

fail() protected method

Throws an exception for the given compared value and test description
protected fail ( mixed $other, string $description, SebastianBergmann\Comparator\ComparisonFailure $comparisonFailure = null )
$other mixed Evaluated value or object.
$description string Additional information about the test
$comparisonFailure SebastianBergmann\Comparator\ComparisonFailure

failureDescription() protected method

The beginning of failure messages is "Failed asserting that" in most cases. This method should return the second part of that sentence. To provide additional failure information additionalFailureDescription can be used.
protected failureDescription ( mixed $other ) : string
$other mixed Evaluated value or object.
return string

matches() protected method

This method can be overridden to implement the evaluation algorithm.
protected matches ( mixed $other ) : boolean
$other mixed Value or object to evaluate.
return boolean

Property Details

$exporter protected property

protected $exporter