KsortedArrayEqualTo
final class KsortedArrayEqualTo extends AbstractKsortedConstraint
Constraint that accepts arrays equal to specified one when key-sorted.
The == operator (equality) is used for comparison.
$matcher = KsortedArrayEqualTo::create([ 'name' => 'John', 'age' => '21' ]);
self::assertThat([ 'age' => 21, 'name' => 'John', ], $matcher);
Traits
Methods
Returns a string representation of the constraint.
Returns the description of the failure.
Returns the description of the failure when this constraint appears in context of an $operator expression.
Returns a custom string representation of the constraint object when it appears in context of an $operator expression.
Returns an instance of ComparatorInterface which implements comparison operator.
Evaluates the constraint for parameter $other.
Evaluates the constraint for parameter $other. Returns true if the constraint is met, false otherwise.
No description
Details
        in 
ShortFailureDescriptionTrait at line 25
            abstract                string
    toString()
        
    
    Returns a string representation of the constraint.
        in 
ShortFailureDescriptionTrait at line 35
        final                    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.
        in 
ShortFailureDescriptionTrait at line 56
        final                    string
    failureDescriptionInContext(Operator $operator, mixed $role, mixed $other)
        
    
    Returns the description of the failure when this constraint appears in context of an $operator expression.
The purpose of this method is to provide meaningful failue description in context of operators such as LogicalNot. Native PHPUnit constraints are supported out of the box by LogicalNot, but externally developed ones had no way to provide correct messages in this context.
The method shall return empty string, when it does not handle customization by itself.
        in 
ShortFailureDescriptionTrait at line 82
            abstract        protected        string
    toStringInContext(Operator $operator, mixed $role)
        
    
    Returns a custom string representation of the constraint object when it appears in context of an $operator expression.
The purpose of this method is to provide meaningful descriptive string in context of operators such as LogicalNot. Native PHPUnit constraints are supported out of the box by LogicalNot, but externally developed ones had no way to provide correct strings in this context.
The method shall return empty string, when it does not handle customization by itself.
        in 
AbstractKsortedConstraint at line 46
        final            protected        
    __construct(ComparatorInterface $comparator, array $expected, int $flags)
        
    
    No description
        in 
AbstractKsortedConstraint at line 56
        final                    ComparatorInterface
    getComparator()
        
    
    Returns an instance of ComparatorInterface which implements comparison operator.
        in 
AbstractKsortedConstraint at line 89
        final                    bool|null
    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 
AbstractKsortedConstraint at line 118
        final                    array
    ksorted(array $array)
        
    
    Returns key-sorted copy of $array.
        in 
AbstractKsortedConstraint at line 158
        final            protected        bool
    matches(mixed $other)
        
    
    Evaluates the constraint for parameter $other. Returns true if the constraint is met, false otherwise.
        in 
AbstractKsortedConstraint at line 172
        final            protected        bool
    supports(mixed $other)
        
    
    No description
        at line 33
                static            KsortedArrayEqualTo
    create(array $expected, int $flags = SORT_REGULAR)
        
    
    No description