This is something we've tried using, and hence mocking in tests at $work recently. This script fails with the same error we're seeing, so is a good starting point for adding the functionality: $ prove -lv t/030_st_execute_array.t t/030_st_execute_array.t .. ok 1 - use DBD::Mock; ok 2 - use DBI; DBD::Mock::st execute_array failed: 3 bind values supplied but 0 expected at t/030_st_execute_array.t line 28. not ok 3 - Called execute_array() ok # Failed test 'Called execute_array() ok' # at t/030_st_execute_array.t line 30. 1..3 # Looks like you failed 1 test of 3. Dubious, test returned 1 (wstat 256, 0x100) Failed 1/3 subtests
…for session exhaustion Basically it succeeds despite there being no states left to verify, and on return the ->execute method fails with an unhelpful error "Can't use an undefined value # as an ARRAY reference at ../lib/DBD/Mock.pm line 635."
$dbh->prepare does not guarantee to return a valid statement handle. It may return a false value. So check the returned value, and abort if it is false, otherwise the error caused ->prepare to fail will get overwritten by a less helpful one which says "Can't call method 'execute' on an undefined value" error.
…t ->prepare failure This is reported in RT ticket #66815 Basically any call to ->begin_work, ->commit, >rollback made when their internal call to ->prepare returns an invalid statement handle will not notice and proceed to use it anyway. In particular, this happens when a DBD::Mock::Session is in effect, and the session state list has been exhausted. When this happens, the method in question fails with an unhelpful error "Can't use an undefined value as an ARRAY reference at ../lib/DBD/Mock.pm line 635", masking the real reason.