24 lines
443 B
Perl
24 lines
443 B
Perl
package L3TDE::Test::DB;
|
|
|
|
use Test::MockModule;
|
|
use DBI;
|
|
|
|
sub mock {
|
|
my $class = shift;
|
|
my $self = bless {}, $class;
|
|
my $dbh = DBI->connect('DBI:Mock:', '', '');
|
|
my $mock_module = Test::MockModule->new('L3TDE::DB');
|
|
$mock_module->mock(connect => sub {
|
|
return $dbh;
|
|
});
|
|
$self->{mock} = $mock_module;
|
|
$self->{dbh} = $dbh;
|
|
return $self;
|
|
}
|
|
|
|
sub dbh {
|
|
my $self = shift;
|
|
return $self->{dbh};
|
|
}
|
|
1;
|