I haven't used mock objects much - most of what I've tested hasn't either required objects or the real things have been easy enough to instantiate in place. Right now it was far easier to just get an object that satisfied $obj->foo == 1 than it was to get the real thing and get it to return true or false. I wasn't testing the entire suite - I just want to test a single function that's getting refactored and need to supply differing boolean values.
Incidentally, it was Devel::Spy which told me I needed to go treat this method as a boolean. Neat module. Glad I wrote it. I hope I'll get use out of it more than once.
⠤⠤ ⠙⠊⠕⠞⠁⠇⠑⠧⠊
In reply to Re^2: Smallish mock objects
by diotalevi
in thread Smallish mock objects
by diotalevi
| For: | Use: | ||
| & | & | ||
| < | < | ||
| > | > | ||
| [ | [ | ||
| ] | ] |