final class ArrayValuesIdenticalTo extends AbstractRecursiveConstraint

Constraint that accepts arrays having values identical to specified ones.

Compares only values present in the array of expectations. The === operator (identity) is used for comparison.

 $matcher = ArrayValuesIdenticalTo::create([
     'name' => 'John', 'age' => '21'
 ]);

 self::assertThat([
     'age' => '21',
     'name' => 'John',
 ], $matcher);

Traits

Methods

static void
validateExpectations(array $expected, int $argument, int $distance = 1)

No description

makeSelector()

Creates instance of ArrayValueSelector.

makeComparator()

Creates instance of IdentityComparator.

static ValuesInterface
makeExpectedValues(array $array)

Creates instance of ValuesInterface to be used as expected values.

Details

static RecursiveConstraintSpecializationTrait create(array $expected)

No description

Parameters

array $expected

Return Value

RecursiveConstraintSpecializationTrait

Exceptions

InvalidArgumentException

static protected void validateExpectations(array $expected, int $argument, int $distance = 1)

No description

Parameters

array $expected
int $argument
int $distance

Return Value

void

at line 56
static protected ValueSelectorInterface makeSelector()

Creates instance of ArrayValueSelector.

Return Value

ValueSelectorInterface

at line 47
static protected ComparatorInterface makeComparator()

Creates instance of IdentityComparator.

Return Value

ComparatorInterface

at line 65
static protected ValuesInterface makeExpectedValues(array $array)

Creates instance of ValuesInterface to be used as expected values.

Parameters

array $array

Return Value

ValuesInterface