- \PHPUnit_Framework_Constraint
- \PHPUnit_Framework_Constraint_IsEqual
class (none) \ PHPUnit_Framework_Constraint_IsEqual
- All implemented interfaces:
- Countable, PHPUnit_Framework_SelfDescribing
Constraint that checks if one value is equal to another.
Equality is checked with PHP's == operator, the operator is explained in detail at {@url http://www.php.net/manual/en/types.comparisons.php}. Two values are equal if they have the same value disregarding type.
The expected value is passed in the constructor.
Method Summary
| Name | Description |
|---|---|
| __construct($value, $delta = 0, $maxDepth = 10, $canonicalize = false, $ignoreCase = false) | |
| evaluate($other, $description = "", $returnResult = false) | Evaluates the constraint for parameter $other |
| toString() | Returns a string representation of the constraint. |
Inherited Method Summary
| Name | Description |
|---|---|
| additionalFailureDescription($other) | Return additional failure description where needed (from PHPUnit_Framework_Constraint) |
| count() | Counts the number of constraint elements. (from PHPUnit_Framework_Constraint) |
| fail($other, $description, ComparisonFailure $comparisonFailure = null) | Throws an exception for the given compared value and test description (from PHPUnit_Framework_Constraint) |
| failureDescription($other) | Returns the description of the failure (from PHPUnit_Framework_Constraint) |
| matches($other) | Evaluates the constraint for parameter $other. Returns true if the constraint is met, false otherwise. (from PHPUnit_Framework_Constraint) |
public function __construct($value, $delta = 0, $maxDepth = 10, $canonicalize = false, $ignoreCase = false)
- Overrides:
- __construct()
- Parameters:
mixed- $valuefloat- $deltainteger- $maxDepthboolean- $ignoreCase- Defaults:
delta= 0maxDepth= 10canonicalize=falseignoreCase=false- Throws:
- PHPUnit_Framework_Exception
public function evaluate($other, $description = "", $returnResult = false)
Evaluates the constraint for parameter $other
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.
- Overrides:
- evaluate($other, $description = "", $returnResult = false)
- Parameters:
mixed- $other Value or object to evaluate.string- $description Additional information about the testbool- $returnResult Whether to return a result or throw an exception- Defaults:
description=""returnResult=false- Returns:
- mixed
- Throws:
- PHPUnit_Framework_ExpectationFailedException
public function toString()
Returns a string representation of the constraint.
- Returns:
- string