final class ArrayValuesEqualTo extends AbstractRecursiveConstraint

Constraint that accepts arrays having values equal to specified ones.

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

 $matcher = ArrayValuesEqualTo::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 EqualityComparator.

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 EqualityComparator.

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