phpunit
phpunit copied to clipboard
Canonicalize by sorting keys instead of values
Using assertEqualsCanonicalizing effectively uses sort() to canonicalize arrays. I fail to see where this might become helpful in a unit test scenario (unidentifiable values whose order doesn't matter)? On the other hand (unordered) key/value collections (i.e. arrays with non-integer keys) are a common thing which would need to be canonicalized with ksort() instead and currently are cumbersome to compare against each other.
Maybe I'm missing on the design decision behind that. :slightly_smiling_face: Or in other words: What about supporting the latter case out of the box as well?