IsEqual
class IsEqual extends Constraint (View source)
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.
Properties
protected | $exporter | from Constraint | |
protected mixed | $value | ||
protected float | $delta | ||
protected int | $maxDepth | ||
protected bool | $canonicalize | ||
protected bool | $ignoreCase | ||
protected ComparisonFailure | $lastFailure |
Methods
No description
Evaluates the constraint for parameter $other
Evaluates the constraint for parameter $other. Returns true if the constraint is met, false otherwise.
Throws an exception for the given compared value and test description
Return additional failure description where needed
Returns a string representation of the constraint.
Details
at line 66
__construct(mixed $value, float $delta = 0.0, int $maxDepth = 10, bool $canonicalize = false, bool $ignoreCase = false)
at line 111
mixed
evaluate(mixed $other, string $description = '', bool $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.
in Constraint at line 76
protected bool
matches(mixed $other)
Evaluates the constraint for parameter $other. Returns true if the constraint is met, false otherwise.
This method can be overridden to implement the evaluation algorithm.
in Constraint at line 86
int
count()
Counts the number of constraint elements.
in Constraint at line 100
protected
fail(mixed $other, string $description, ComparisonFailure $comparisonFailure = null)
Throws an exception for the given compared value and test description
in Constraint at line 133
protected string
additionalFailureDescription(mixed $other)
Return additional failure description where needed
The function can be overridden to provide additional failure information like a diff
in Constraint at line 151
protected string
failureDescription(mixed $other)
Returns the description of the failure
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.
at line 154
string
toString()
Returns a string representation of the constraint.