In the context of developing tests for a system with pluggable persistence schemes I found myself needing something like a mock DBD implementation. This would be loaded and instantiated like a normal DBD through the connect() call and would behave like a normal DBD.

But instead of storing and fetching data it would simply store the SQL statements passed to it via prepare() and the bound parameters used in bind_param() and execute() calls. These could be returned via statement properties or other appropriate means. It would also be similar to a Test::MockObject object in that you could hardwire the return values programmatically.

I didn't find anything like this around, but it's hard to do an exhaustive search for something in this area -- people create their own, refer to it by different terms, etc. Is anyone familiar with this? If not, do you think it would be useful for general release?

Thanks,

Chris

--
Chris Winters
Creating enterprise-capable snack systems since 1988



Reply via email to