You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
In both cases, there is one item extra item the actual value compared to the expected value, but in one case the diff shows that very clearly, and in the other case, the diff has extra noise.
Interesting that the PHPUnit manual for assertEqualsCanonicalizing() also shows the noise. So this seems to be the intended behavior, even though it is not helpful and not what you would expect given the implication that as the arrays are sorted and the keys should be simply ignored.
Also minor point @joachim-n but I think you have a typo in your 'expected behavior'. You say "only gamma is surplus" but it is actually 'beta' that is surplus, that is, 'beta' is in array 2 but not array 1.
Summary
The diff output when assertEqualsCanonicalizing() fails is affected by the order of the arrays.
Current behavior
Consider this assertion:
the output is:
but with this assertion:
The output is:
In both cases, there is one item extra item the actual value compared to the expected value, but in one case the diff shows that very clearly, and in the other case, the diff has extra noise.
How to reproduce
Expected behavior
Only 'beta' is surplus, so the output should be:
The text was updated successfully, but these errors were encountered: