Constraint that asserts that one value is identical to another.

Identical check is performed with PHP's === operator, the operator is explained in detail at {@url https://php.net/manual/en/types.comparisons.php}. Two values are identical if they have the same value and are of the same type.

The expected value is passed in the constructor.

CloneableFinalInstantiable
ExtendsPHPUnit\Framework\Constraint\Constraint
ImplementsCountable
PHPUnit\Framework\SelfDescribing
Methods
public __construct( $value)
public PHPUnit\Framework\Constraint\Constraint::count() : int
 
Counts the number of constraint elements.

public evaluate( $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.

  • throws ExpectationFailedException
  • throws SebastianBergmann\RecursionContext\InvalidArgumentException
public toString() : string
 
Returns a string representation of the constraint.

  • throws SebastianBergmann\RecursionContext\InvalidArgumentException
Methods
protected PHPUnit\Framework\Constraint\Constraint::additionalFailureDescription( $other) : string
 
Return additional failure description where needed

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

    protected PHPUnit\Framework\Constraint\Constraint::exporter() : SebastianBergmann\Exporter\Exporter
    protected PHPUnit\Framework\Constraint\Constraint::fail( $other, $description, ?SebastianBergmann\Comparator\ComparisonFailure $comparisonFailure = NULL) : void
     
    Throws an exception for the given compared value and test description

    • throws ExpectationFailedException
    • throws SebastianBergmann\RecursionContext\InvalidArgumentException
    protected failureDescription( $other) : string
     
    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.

    • throws SebastianBergmann\RecursionContext\InvalidArgumentException
    protected PHPUnit\Framework\Constraint\Constraint::matches( $other) : bool
     
    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.

    • codeCoverageIgnore
    Constants
    private PHPUnit\Framework\Constraint\IsIdentical::EPSILON = 1.0E-10
     


    • var float
    Properties
    private $value
     


    • var mixed
    © 2020 Bruce Wells
    Search Namespaces \ Classes
    ConfigurationNumbers (0-9.) only