This test fails as it should.
$keyed = array(1 => 'foo', 2 => 'bar');
$indexed = array('foo', 'bar');
assertThat($keyed, is($indexed));
But the error message is misleading.
Expected: is ["foo", "bar"]
but: was ["foo", "bar"]
If the keys are not standard numeric indexes they should be output in the
display. The above should show as
Expected: is ["foo", "bar"]
but: was [1 => "foo", 2 => "bar"]
Note that equality (==) for arrays
* compares keys,
* treats indexes as standard keys, and
* ignores insertion order even though var_dump() shows it.
Identity (===) for arrays doesn't ignore insertion order but behaves like ==
otherwise.
Original issue reported on code.google.com by dharkn...@gmail.com on 15 Mar 2011 at 5:29
Original issue reported on code.google.com by
dharkn...@gmail.com
on 15 Mar 2011 at 5:29