comparator
comparator copied to clipboard
ArrayComparator#assertEquals(), canonicalizing stops it from comparing array keys
When using the canonicalize option both expected and actual arrays get sorted, and keys are removed, which causes comparison to be ok even if keys were not equal.
If canonicalize is set to false, comparison fails if keys are not equal.

Arrays are equal if they contain the same key-value pairs.
https://github.com/sebastianbergmann/comparator/blob/c57ba51c28b64ef8a4b14b40bceb2c5ca19e9406/src/ArrayComparator.php#L15
So it seems like sort must not be used to canonicalize arrays.
Maybe using ksort to sort by key? Problem is there's only 1 test that checks canonicalized arrays, and it fails if using ksort.
