ArrayComparator
extends Comparator
in package
Compares arrays for equality.
Arrays are equal if they contain the same key-value pairs. The order of the keys does not matter. The types of key-value pairs do not matter.
Table of Contents
Properties
Methods
- __construct() : mixed
- accepts() : bool
- Returns whether the comparator can compare two values.
- assertEquals() : mixed
- Asserts that two arrays are equal.
- setFactory() : mixed
- indent() : mixed
Properties
$exporter
protected
Exporter
$exporter
$factory
protected
Factory
$factory
Methods
__construct()
public
__construct() : mixed
accepts()
Returns whether the comparator can compare two values.
public
accepts(mixed $expected, mixed $actual) : bool
Parameters
- $expected : mixed
-
The first value to compare
- $actual : mixed
-
The second value to compare
Return values
boolassertEquals()
Asserts that two arrays are equal.
public
assertEquals(mixed $expected, mixed $actual[, float $delta = 0.0 ][, bool $canonicalize = false ][, bool $ignoreCase = false ][, array<string|int, mixed> &$processed = [] ]) : mixed
Parameters
- $expected : mixed
-
First value to compare
- $actual : mixed
-
Second value to compare
- $delta : float = 0.0
-
Allowed numerical distance between two values to consider them equal
- $canonicalize : bool = false
-
Arrays are sorted before comparison when set to true
- $ignoreCase : bool = false
-
Case is ignored when set to true
- $processed : array<string|int, mixed> = []
-
List of already processed elements (used to prevent infinite recursion)
Tags
setFactory()
public
setFactory(Factory $factory) : mixed
Parameters
- $factory : Factory
indent()
protected
indent(mixed $lines) : mixed
Parameters
- $lines : mixed