Documentation

PHPUnit_Framework_Constraint_IsEqual extends PHPUnit_Framework_Constraint
in package

Constraint that checks if one value is equal to another.

Equality is checked with PHP's == operator, the operator is explained in detail at 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.

Tags
since

Class available since Release 3.0.0

Table of Contents

$canonicalize  : bool
$delta  : float
$exporter  : mixed
$ignoreCase  : bool
$lastFailure  : ComparisonFailure
$maxDepth  : int
$value  : mixed
__construct()  : mixed
count()  : int
Counts the number of constraint elements.
evaluate()  : mixed
Evaluates the constraint for parameter $other
toString()  : string
Returns a string representation of the constraint.
additionalFailureDescription()  : string
Return additional failure description where needed
fail()  : mixed
Throws an exception for the given compared value and test description
failureDescription()  : string
Returns the description of the failure
matches()  : bool
Evaluates the constraint for parameter $other. Returns true if the constraint is met, false otherwise.

Properties

$canonicalize

protected bool $canonicalize = alse

$ignoreCase

protected bool $ignoreCase = alse

$maxDepth

protected int $maxDepth = 10

Methods

__construct()

public __construct(mixed $value[, float $delta = 0.0 ][, int $maxDepth = 10 ][, bool $canonicalize = false ][, bool $ignoreCase = false ]) : mixed
Parameters
$value : mixed
$delta : float = 0.0
$maxDepth : int = 10
$canonicalize : bool = false
$ignoreCase : bool = false
Tags
throws
PHPUnit_Framework_Exception
Return values
mixed

count()

Counts the number of constraint elements.

public count() : int
Tags
since

Method available since Release 3.4.0

Return values
int

evaluate()

Evaluates the constraint for parameter $other

public evaluate(mixed $other[, string $description = '' ][, bool $returnResult = false ]) : mixed

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.

Parameters
$other : mixed

Value or object to evaluate.

$description : string = ''

Additional information about the test

$returnResult : bool = false

Whether to return a result or throw an exception

Tags
throws
PHPUnit_Framework_ExpectationFailedException
Return values
mixed

toString()

Returns a string representation of the constraint.

public toString() : string
Return values
string

additionalFailureDescription()

Return additional failure description where needed

protected additionalFailureDescription(mixed $other) : string

The function can be overridden to provide additional failure information like a diff

Parameters
$other : mixed

Evaluated value or object.

Return values
string

failureDescription()

Returns the description of the failure

protected failureDescription(mixed $other) : string

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.

Parameters
$other : mixed

Evaluated value or object.

Return values
string

matches()

Evaluates the constraint for parameter $other. Returns true if the constraint is met, false otherwise.

protected matches(mixed $other) : bool

This method can be overridden to implement the evaluation algorithm.

Parameters
$other : mixed

Value or object to evaluate.

Return values
bool

Search results