 |
Quick To Setup
my ($mock1);
use Test::MockObject;
BEGIN {
$mock1 = Test::MockObject->new();
$mock1->fake_module( 'DBI::db',
'prepare' =>\&TestDB::prepare,
'prepare_cached' =>\&TestDB::prepare_cached,
'rebind' =>\&TestDB::rebind,
'bind_param' =>\&TestDB::bind_param,
'execute' =>\&TestDB::execute,
'fetchrow_hashref' =>\&TestDB::fetchrow_hashref,
'fetchall_arrayref' =>\&TestDB::fetchall_arrayref,
'fetchrow_array' =>\&TestDB::fetchrow_array,
'finish' =>\&TestDB::finish);
$mock1->fake_new( 'DBI::db' );
}
use DBI::db;
|
Points to another module (TestDB) that contains the fake functions that return our test data.
|