Join GitHub today
GitHub is home to over 28 million developers working together to host and review code, manage projects, and build software together.Sign up
Improve Phake::verify error message #144
A very common use case for me, and others I imagine, is to verify that a method was called with some value or array. The naive way of doing this:
Leads to error messages like:
For complex objects or arrays it can be very hard to tell what exactly failed. I've been resorting to:
Which gives me a nice diff around where things didn't match. I don't need the diff, but at least fully printing the actual array in both places would improve things greatly. Any way to improve these error messages? I know Mockito gives a much more descriptive list of things that didn't match.
added a commit
Apr 7, 2015
The commit above implements much improved verification messages in the case of failures.
You will now see why each call to the method failed to match your verification including diffs in most cases. For PHPUnit I am just leveraging the built in constraint errors, same for hamcrest. For our built in equality matcher I completely revamped that to use sebastian/comparator instead of my own code.
I would love to get some early feedback before I roll a release with this. You can get it with