use Modern::Perl;
use C4::Context;
use DBD::Mock;
use Koha::Schema;
use Test::MockModule;
my %configs;
}
sub mock_dbh {
my $context = new Test::MockModule('C4::Context');
our $context = new Test::MockModule('Koha::Database');
$context->mock( '_new_dbh', sub {
$context->mock( '_new_schema', sub {
my $dbh = DBI->connect( 'DBI:Mock:', '', '' )
my $dbh = Koha::Schema->connect( 'DBI:Mock:', '', '' );
|| die "Cannot create handle: $DBI::errstr\n";
return $dbh;
} );
return $context;
-